| Task: | Mex value |
| Sender: | Crinoid |
| Submission time: | 2017-01-22 12:01:25 +0200 |
| Language: | C++ |
| Status: | READY |
| Result: | 28 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 28 |
| #2 | WRONG ANSWER | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.04 s | 1 | details |
| #2 | ACCEPTED | 0.04 s | 1 | details |
| #3 | ACCEPTED | 0.05 s | 1 | details |
| #4 | ACCEPTED | 0.04 s | 1 | details |
| #5 | ACCEPTED | 0.04 s | 1 | details |
| #6 | ACCEPTED | 0.04 s | 1 | details |
| #7 | ACCEPTED | 0.04 s | 1 | details |
| #8 | ACCEPTED | 0.04 s | 1 | details |
| #9 | ACCEPTED | 0.04 s | 1 | details |
| #10 | ACCEPTED | 0.04 s | 1 | details |
| #11 | WRONG ANSWER | 0.06 s | 2 | details |
| #12 | WRONG ANSWER | 0.07 s | 2 | details |
| #13 | WRONG ANSWER | 0.07 s | 2 | details |
| #14 | WRONG ANSWER | 0.06 s | 2 | details |
| #15 | WRONG ANSWER | 0.07 s | 2 | details |
| #16 | WRONG ANSWER | 0.08 s | 2 | details |
| #17 | WRONG ANSWER | 0.08 s | 2 | details |
| #18 | WRONG ANSWER | 0.07 s | 2 | details |
| #19 | WRONG ANSWER | 0.05 s | 2 | details |
| #20 | WRONG ANSWER | 0.07 s | 2 | details |
Code
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
const ll mod7 = 1000000007;
#define eb(x) emplace_back(x)
#define ef(x) emplace_front(x)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define ob(x) pop_back(x)
#define of(x) pop_front(x)
#define mp(a, b) make_pair(a, b)
#define power(x, p) round(pow(x, (double)p))
#define all(x) x.begin(), x.end()
#define sortAs(x) sort(all(x));
#define sortDes(x) sort(all(x), std::greater<ll>());
#define fori(x) for (ll i = 0; i < x; i++)
#define forj(x) for (ll j = 0; j < x; j++)
#define fork(x) for (ll k = 0; k < x; k++)
#define ret(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define rep(u, s, x) for (ll u = s; u <= x; u++)
#define rem(u, x, s) for (ll u = s; u >= x; u--)
#define RET(t) cout << t << endl; return 0;
#define RETIF(i, t) if (i) { cout << t << endl; return 0; }
#define BREAKIF(i, t) if (i) { cout << t << endl; break; }
#define CONTIF(i, t) if (i) { cout << t << endl; continue; }
#define NEWLINE cout << endl;
#define DBG(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); cout << endl; }
vector<string> split(const string& s, char c) {
vector<string> v;
stringstream ss(s);
string x;
while (getline(ss, x, c))
v.emplace_back(x);
return move(v);
}
void err(vector<string>::iterator it) {}
template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
cout << it -> substr((*it)[0] == ' ', it -> length()) << ": " << a << " ";
err(++it, args...);
}
#define DBGARRAY(x, s) cout << #x << ": "; for (int z = 0; z < s; z++) cout << x[z] << " "; cout << endl;
#define DBGVECTOR(x) cout << #x << ": "; for (ll z = 0; z < x.size(); z++) cout << x[z] << " "; cout << endl;
#define DBGVECTORPAR(x, p) cout << #x << ": "; for (ll z = 0; z < x.size(); z++) cout << x[z].p << " "; cout << endl;
#define DBGMAP(x) cout << #x << ":" << endl; for (auto z = x.begin(); z != x.end(); z++) { cout << z->first << ": " << z->second << endl; }
#define DBGSET(x) cout << #x << ":" << endl; for (auto z = x.begin(); z != x.end(); z++) { cout << *z << endl;}
bool isPrime(long long a) { if (a <= 1) return 0; for(long long i = 2; i * i <= a; i++) { if(a % i == 0) return 0; } return 1; }
ll lcm(ll a, ll b) { return __gcd(a, b) ? (a / __gcd(a, b) * b) : 0; }
template<typename T>
ll biggest(T x) {ll b_i = 0; fori(x.size()) {if (x[b_i] < x[i]) {b_i = i;} } return b_i;}
template<typename T>
ll smallest(T x) {ll s_i = 0; fori(x.size()) {if (x[s_i] > x[i]) {s_i = i;} } return s_i;}
template<typename T>
string tostring(T num) { stringstream convert; convert << num; return convert.str(); }
template<typename T>
ll tonumber(T stringNum) { ll a; stringstream convert; convert << stringNum; convert >> a; return a; }
ll A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z;
char C1, C2, C3, C4;
string S1, S2, S3, S4;
vl V1, V2, V3, V4;
bool B1, B2;
int arr[110];
int main()
{
std::ios_base::sync_with_stdio(0); cin.tie(0); cin.clear();
cin >> N >> K;
V1.assign(N, 0);
fori(N)
{
cin >> V1[i];
}
// map<int, int> occ;
int low = 0, hi = -1;
fori(K)
{
hi++;
if (V1[hi] < 102)
arr[V1[hi]]++;
}
fori(N - K + 1)
{
// DBGMAP(occ)
// int a = 0;
// for(auto it = occ.begin(); it != occ.end(); it++)
// {
// if (it->second == 0 || it->first != a)
// {
// cout << a << " ";
// break;
// }
// a++;
// }
forj(101)
{
if (arr[j] == 0)
{
cout << j << " ";
break;
}
}
hi++;
if (V1[hi] < 102)
arr[V1[hi]]++;
// occ[V1[hi]]++;
// occ[V1[low]]--;
if (V1[low] < 102)
arr[V1[low]]--;
low++;
}
}
Test details
Test 1
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 100 10 1000000000 9 1 0 5 7 2 8 6 3 4... |
| correct output |
|---|
| 4 10 9 1 1 1 1 1 1 1 1 4 10 3 ... |
| user output |
|---|
| 4 10 9 1 1 1 1 1 1 1 1 4 10 3 ... |
Test 2
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 100 10 1000000000 4 3 8 1 0 9 5 7 2 6... |
| correct output |
|---|
| 6 10 4 3 3 1 1 1 1 1 3 3 10 6 ... |
| user output |
|---|
| 6 10 4 3 3 1 1 1 1 1 3 3 10 6 ... |
Test 3
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 100 10 1000000000 9 2 3 1 0 8 5 6 4 7... |
| correct output |
|---|
| 7 10 9 2 2 1 0 1 1 1 2 9 10 4 ... |
| user output |
|---|
| 7 10 9 2 2 1 0 1 1 1 2 9 10 4 ... |
Test 4
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 100 10 1000000000 3 0 4 6 5 7 1 2 8 9... |
| correct output |
|---|
| 9 10 3 0 0 0 0 0 4 2 2 2 10 6 ... |
| user output |
|---|
| 9 10 3 0 0 0 0 0 4 2 2 2 10 6 ... |
Test 5
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 100 10 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 ... |
| correct output |
|---|
| 10 10 10 10 10 10 10 10 10 10 ... |
| user output |
|---|
| 10 10 10 10 10 10 10 10 10 10 ... |
Test 6
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 100 10 1000000000 0 5 1 9 3 4 6 7 2 8... |
| correct output |
|---|
| 8 10 0 5 1 1 1 1 1 5 2 5 10 0 ... |
| user output |
|---|
| 8 10 0 5 1 1 1 1 1 5 2 5 10 0 ... |
Test 7
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 100 10 1000000000 1 2 9 3 8 0 4 7 5 6... |
| correct output |
|---|
| 6 10 1 1 1 1 2 0 0 2 3 9 10 6 ... |
| user output |
|---|
| 6 10 1 1 1 1 2 0 0 2 3 9 10 6 ... |
Test 8
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 100 10 1000000000 5 0 6 7 1 4 8 3 9 2... |
| correct output |
|---|
| 2 10 5 0 0 0 0 0 0 0 0 1 10 9 ... |
| user output |
|---|
| 2 10 5 0 0 0 0 0 0 0 0 1 10 9 ... |
Test 9
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 100 10 1000000000 7 3 0 1 4 9 2 5 6 8... |
| correct output |
|---|
| 8 10 7 3 0 0 0 0 7 5 5 5 10 8 ... |
| user output |
|---|
| 8 10 7 3 0 0 0 0 7 5 5 5 10 8 ... |
Test 10
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 100 10 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 ... |
| correct output |
|---|
| 10 10 10 10 10 10 10 10 10 10 ... |
| user output |
|---|
| 10 10 10 10 10 10 10 10 10 10 ... |
Test 11
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 100000 10000 1000000000 4786 3512 3285 1919... |
| correct output |
|---|
| 9547 10000 4786 3512 3285 1919... |
| user output |
|---|
| 13 13 13 13 13 13 13 13 13 13 ... |
Test 12
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 100000 10000 1000000000 7981 3955 790 45 34... |
| correct output |
|---|
| 7657 10000 7981 3955 790 45 45... |
| user output |
|---|
| 45 45 45 45 45 45 45 45 45 45 ... |
Test 13
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 100000 10000 1000000000 2329 1825 9435 3800... |
| correct output |
|---|
| 5701 10000 2329 1825 1825 1825... |
| user output |
|---|
| 54 54 54 54 54 54 54 54 54 54 ... |
Test 14
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 100000 10000 1000000000 2754 6029 8007 6286... |
| correct output |
|---|
| 1423 10000 2754 2754 2754 2754... |
| user output |
|---|
| 66 66 66 66 66 66 66 66 66 66 ... |
Test 15
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 100000 10000 0 1 2 3 4 5 6 7 8 9 10 11 12 1... |
| correct output |
|---|
| 10000 10000 10000 10000 10000 ... |
| user output |
|---|
| (empty) |
Test 16
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 100000 10000 1000000000 7560 4634 7044 3853... |
| correct output |
|---|
| 9855 10000 7560 4634 4634 3853... |
| user output |
|---|
| 35 35 35 35 35 35 35 35 35 35 ... |
Test 17
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 100000 10000 1000000000 7945 6674 3975 3002... |
| correct output |
|---|
| 6373 10000 7945 6674 3975 3002... |
| user output |
|---|
| 58 58 58 58 58 58 58 58 58 58 ... |
Test 18
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 100000 10000 1000000000 2506 6827 6871 8593... |
| correct output |
|---|
| 2978 10000 2506 2506 2506 2506... |
| user output |
|---|
| 67 67 67 67 67 67 67 67 67 67 ... |
Test 19
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 100000 10000 1000000000 2769 5036 539 4409 ... |
| correct output |
|---|
| 2249 10000 2769 2769 539 539 5... |
| user output |
|---|
| 21 21 21 21 21 21 21 21 21 21 ... |
Test 20
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 100000 10000 0 1 2 3 4 5 6 7 8 9 10 11 12 1... |
| correct output |
|---|
| 10000 10000 10000 10000 10000 ... |
| user output |
|---|
| (empty) |
