CSES - Datatähti 2017 loppu - Results
Submission details
Task:Mex-luku
Sender:while(false)
Submission time:2017-01-19 16:39:35 +0200
Language:C++
Status:READY
Result:28
Feedback
groupverdictscore
#1ACCEPTED28
#20
Test results
testverdicttimegroup
#1ACCEPTED0.04 s1details
#2ACCEPTED0.04 s1details
#3ACCEPTED0.03 s1details
#4ACCEPTED0.04 s1details
#5ACCEPTED0.04 s1details
#6ACCEPTED0.04 s1details
#7ACCEPTED0.05 s1details
#8ACCEPTED0.04 s1details
#9ACCEPTED0.05 s1details
#10ACCEPTED0.04 s1details
#110.09 s2details
#120.09 s2details
#130.09 s2details
#140.09 s2details
#150.09 s2details
#160.10 s2details
#170.07 s2details
#180.09 s2details
#190.07 s2details
#200.10 s2details

Code

#include <iostream>
using namespace std;

int n,k;
int x[100000];
int xk[100000];
int out=0;

int main(){
	cin >> n >> k;
	for (int i=0;i<n;i++){
		cin >> x[i];
		xk[i]=0;
	}
	for (int i=0;i<n;i++){
		if (x[i]<10000) xk[x[i]]++;
		if (x[i]==out){
			for (;xk[out]>0;out++){}
		}
		if (i>=k-1){
			if (i>=k){
				if (x[i-k]<10000) xk[x[i-k]]--;
				if ((x[i-k]<out)&&(xk[x[i-k]]==0)) out=x[i-k];
			}
			cout << out;
		}
	}
	return 0;
}

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
410911111111410300000000210465...

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
610433111113310666000000010211...

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
710922101112910433303311310744...

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
910300000422210661110000010444...

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
101010101010101010101010101010...

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
810051111152510000000033510444...

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
610111120023910665155000810942...

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
210500000000110993365522510771...

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
810730000755510811111114410863...

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
101010101010101010101010101010...

Test 11

Group: 2

Verdict:

input
100000 10000
1000000000 4786 3512 3285 1919...

correct output
9547 10000 4786 3512 3285 1919...

user output
954710000478635123285191919191...

Test 12

Group: 2

Verdict:

input
100000 10000
1000000000 7981 3955 790 45 34...

correct output
7657 10000 7981 3955 790 45 45...

user output
765710000798139557904545454545...

Test 13

Group: 2

Verdict:

input
100000 10000
1000000000 2329 1825 9435 3800...

correct output
5701 10000 2329 1825 1825 1825...

user output
570110000232918251825182518251...

Test 14

Group: 2

Verdict:

input
100000 10000
1000000000 2754 6029 8007 6286...

correct output
1423 10000 2754 2754 2754 2754...

user output
142310000275427542754275427542...

Test 15

Group: 2

Verdict:

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
100001000010000100001000010000...

Test 16

Group: 2

Verdict:

input
100000 10000
1000000000 7560 4634 7044 3853...

correct output
9855 10000 7560 4634 4634 3853...

user output
985510000756046344634385338531...

Test 17

Group: 2

Verdict:

input
100000 10000
1000000000 7945 6674 3975 3002...

correct output
6373 10000 7945 6674 3975 3002...

user output
637310000794566743975300289820...

Test 18

Group: 2

Verdict:

input
100000 10000
1000000000 2506 6827 6871 8593...

correct output
2978 10000 2506 2506 2506 2506...

user output
297810000250625062506250625062...

Test 19

Group: 2

Verdict:

input
100000 10000
1000000000 2769 5036 539 4409 ...

correct output
2249 10000 2769 2769 539 539 5...

user output
224910000276927695395395395395...

Test 20

Group: 2

Verdict:

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
100001000010000100001000010000...