Code Submission Evaluation System Login

Datatähti 2017 loppu

Start:2017-01-19 12:15:00
End:2017-01-19 17:15:00
 

Tasks | Messages | Scoreboard | Statistics


CSES - Datatähti 2017 loppu - Results
History
2017-01-19 15:09:56100
2017-01-19 15:09:44100
2017-01-19 15:03:380
2017-01-19 14:45:2328
2017-01-19 14:30:1328
2017-01-19 14:20:090
2017-01-19 13:53:070
2017-01-19 13:45:310
2017-01-19 13:31:520
2017-01-19 13:30:570
Task:Mex-luku
Sender:kh
Submission time:2017-01-19 15:09:56
Language:C++
Status:READY
Score:100

Feedback

groupverdictscore
#1ACCEPTED28
#2ACCEPTED72

Test results

testverdicttime (s)group
#1ACCEPTED0.05 / 1.001details
#2ACCEPTED0.04 / 1.001details
#3ACCEPTED0.04 / 1.001details
#4ACCEPTED0.04 / 1.001details
#5ACCEPTED0.03 / 1.001details
#6ACCEPTED0.04 / 1.001details
#7ACCEPTED0.04 / 1.001details
#8ACCEPTED0.04 / 1.001details
#9ACCEPTED0.05 / 1.001details
#10ACCEPTED0.04 / 1.001details
#11ACCEPTED0.14 / 1.002details
#12ACCEPTED0.11 / 1.002details
#13ACCEPTED0.14 / 1.002details
#14ACCEPTED0.15 / 1.002details
#15ACCEPTED0.10 / 1.002details
#16ACCEPTED0.12 / 1.002details
#17ACCEPTED0.15 / 1.002details
#18ACCEPTED0.17 / 1.002details
#19ACCEPTED0.13 / 1.002details
#20ACCEPTED0.12 / 1.002details

Code

#include <bits/stdc++.h>
#include <iterator>

using namespace std;
typedef long long ll;

int main() {
     int n, k;
     cin >> n >> k;
     int p[101010];
     multiset<int> s;
     for (int i = 1; i<=n; i++) {
     	cin >> p[i];
     }
     for (int j = 1; j<=k; j++) s.insert(p[j]);
     int min = 0;
     int minhaku = 0;
     for (int j = minhaku; j<1000000001; j++) {
        	if (!s.count(j)) {
        		min = j;
        		break;
        	}
        }
        bool b = false;
     for (int i = k; i <= n; i++) {
     if (b) {
     	for (int j = minhaku; j<1000000000; j++) {
        	if (!s.count(j)) {
        		min = j;
        		cout << j << " ";
        		b = false;
        		break;
        	}
        }
     }
     else cout << min << " ";
     
        int d = p[i+1];
        int c = p[i-k+1];
     	s.insert(d);
     	s.erase(s.find(c));
     	if (c <= min && !s.count(c)) min = c;
     	if (d == min) {
     	b = true;
     	minhaku = d+1;
     	}     	
     	}
     cout << "\n";
     return 0;
     }


Test details

Test 1

Group: 1

Verdict: ACCEPTED

input
100 10
1000000000 9 1 0 5 7 2 8 6 3 4...
view   save

correct output
4 10 9 1 1 1 1 1 1 1 1 4 10 3 ...
view   save

user output
4 10 9 1 1 1 1 1 1 1 1 4 10 3 ...
view   save

Test 2

Group: 1

Verdict: ACCEPTED

input
100 10
1000000000 4 3 8 1 0 9 5 7 2 6...
view   save

correct output
6 10 4 3 3 1 1 1 1 1 3 3 10 6 ...
view   save

user output
6 10 4 3 3 1 1 1 1 1 3 3 10 6 ...
view   save

Test 3

Group: 1

Verdict: ACCEPTED

input
100 10
1000000000 9 2 3 1 0 8 5 6 4 7...
view   save

correct output
7 10 9 2 2 1 0 1 1 1 2 9 10 4 ...
view   save

user output
7 10 9 2 2 1 0 1 1 1 2 9 10 4 ...
view   save

Test 4

Group: 1

Verdict: ACCEPTED

input
100 10
1000000000 3 0 4 6 5 7 1 2 8 9...
view   save

correct output
9 10 3 0 0 0 0 0 4 2 2 2 10 6 ...
view   save

user output
9 10 3 0 0 0 0 0 4 2 2 2 10 6 ...
view   save

Test 5

Group: 1

Verdict: ACCEPTED

input
100 10
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 ...
view   save

correct output
10 10 10 10 10 10 10 10 10 10 ...
view   save

user output
10 10 10 10 10 10 10 10 10 10 ...
view   save

Test 6

Group: 1

Verdict: ACCEPTED

input
100 10
1000000000 0 5 1 9 3 4 6 7 2 8...
view   save

correct output
8 10 0 5 1 1 1 1 1 5 2 5 10 0 ...
view   save

user output
8 10 0 5 1 1 1 1 1 5 2 5 10 0 ...
view   save

Test 7

Group: 1

Verdict: ACCEPTED

input
100 10
1000000000 1 2 9 3 8 0 4 7 5 6...
view   save

correct output
6 10 1 1 1 1 2 0 0 2 3 9 10 6 ...
view   save

user output
6 10 1 1 1 1 2 0 0 2 3 9 10 6 ...
view   save

Test 8

Group: 1

Verdict: ACCEPTED

input
100 10
1000000000 5 0 6 7 1 4 8 3 9 2...
view   save

correct output
2 10 5 0 0 0 0 0 0 0 0 1 10 9 ...
view   save

user output
2 10 5 0 0 0 0 0 0 0 0 1 10 9 ...
view   save

Test 9

Group: 1

Verdict: ACCEPTED

input
100 10
1000000000 7 3 0 1 4 9 2 5 6 8...
view   save

correct output
8 10 7 3 0 0 0 0 7 5 5 5 10 8 ...
view   save

user output
8 10 7 3 0 0 0 0 7 5 5 5 10 8 ...
view   save

Test 10

Group: 1

Verdict: ACCEPTED

input
100 10
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 ...
view   save

correct output
10 10 10 10 10 10 10 10 10 10 ...
view   save

user output
10 10 10 10 10 10 10 10 10 10 ...
view   save

Test 11

Group: 2

Verdict: ACCEPTED

input
100000 10000
1000000000 4786 3512 3285 1919...
view   save

correct output
9547 10000 4786 3512 3285 1919...
view   save

user output
9547 10000 4786 3512 3285 1919...
view   save

Test 12

Group: 2

Verdict: ACCEPTED

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

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

user output
7657 10000 7981 3955 790 45 45...
view   save

Test 13

Group: 2

Verdict: ACCEPTED

input
100000 10000
1000000000 2329 1825 9435 3800...
view   save

correct output
5701 10000 2329 1825 1825 1825...
view   save

user output
5701 10000 2329 1825 1825 1825...
view   save

Test 14

Group: 2

Verdict: ACCEPTED

input
100000 10000
1000000000 2754 6029 8007 6286...
view   save

correct output
1423 10000 2754 2754 2754 2754...
view   save

user output
1423 10000 2754 2754 2754 2754...
view   save

Test 15

Group: 2

Verdict: ACCEPTED

input
100000 10000
0 1 2 3 4 5 6 7 8 9 10 11 12 1...
view   save

correct output
10000 10000 10000 10000 10000 ...
view   save

user output
10000 10000 10000 10000 10000 ...
view   save

Test 16

Group: 2

Verdict: ACCEPTED

input
100000 10000
1000000000 7560 4634 7044 3853...
view   save

correct output
9855 10000 7560 4634 4634 3853...
view   save

user output
9855 10000 7560 4634 4634 3853...
view   save

Test 17

Group: 2

Verdict: ACCEPTED

input
100000 10000
1000000000 7945 6674 3975 3002...
view   save

correct output
6373 10000 7945 6674 3975 3002...
view   save

user output
6373 10000 7945 6674 3975 3002...
view   save

Test 18

Group: 2

Verdict: ACCEPTED

input
100000 10000
1000000000 2506 6827 6871 8593...
view   save

correct output
2978 10000 2506 2506 2506 2506...
view   save

user output
2978 10000 2506 2506 2506 2506...
view   save

Test 19

Group: 2

Verdict: ACCEPTED

input
100000 10000
1000000000 2769 5036 539 4409 ...
view   save

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

user output
2249 10000 2769 2769 539 539 5...
view   save

Test 20

Group: 2

Verdict: ACCEPTED

input
100000 10000
0 1 2 3 4 5 6 7 8 9 10 11 12 1...
view   save

correct output
10000 10000 10000 10000 10000 ...
view   save

user output
10000 10000 10000 10000 10000 ...
view   save