# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
226109 | 2020-04-22T14:32:43 Z | MKopchev | Alternating Current (BOI18_alternating) | C++14 | 2805 ms | 3388 KB |
#include<bits/stdc++.h> using namespace std; const int nmax=1e5+42; const double TL=2.8; int sz,n; pair<int,int> inp[nmax]; double start; int type[nmax]; int pref[2][nmax]; mt19937 rng(42); void test() { for(int i=1;i<=sz;i++) { pref[0][i]=0; pref[1][i]=0; } for(int i=1;i<=n;i++) if(inp[i].first<=inp[i].second) { pref[type[i]][inp[i].first]++; pref[type[i]][inp[i].second+1]--; } else { pref[type[i]][inp[i].first]++; pref[type[i]][sz+1]--; pref[type[i]][1]++; pref[type[i]][inp[i].second+1]--; } for(int i=1;i<=sz;i++) { pref[0][i]+=pref[0][i-1]; if(pref[0][i]==0)return; pref[1][i]+=pref[1][i-1]; if(pref[1][i]==0)return; } for(int i=1;i<=n;i++) printf("%i",type[i]); printf("\n"); exit(0); } int main() { start=clock(); scanf("%i%i",&sz,&n); for(int i=1;i<=n;i++) scanf("%i%i",&inp[i].first,&inp[i].second); while(1.0*(clock()-start)/CLOCKS_PER_SEC<TL) { for(int i=1;i<=n;i++) type[i]=rng()%2; test(); } printf("impossible\n"); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 4 ms | 384 KB | Output is correct |
8 | Correct | 2805 ms | 504 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 2804 ms | 384 KB | Output is correct |
11 | Correct | 2805 ms | 384 KB | Output is correct |
12 | Correct | 5 ms | 384 KB | Output is correct |
13 | Correct | 2804 ms | 388 KB | Output is correct |
14 | Correct | 5 ms | 384 KB | Output is correct |
15 | Correct | 4 ms | 384 KB | Output is correct |
16 | Correct | 5 ms | 384 KB | Output is correct |
17 | Correct | 4 ms | 384 KB | Output is correct |
18 | Correct | 5 ms | 384 KB | Output is correct |
19 | Correct | 5 ms | 384 KB | Output is correct |
20 | Correct | 4 ms | 384 KB | Output is correct |
21 | Correct | 5 ms | 384 KB | Output is correct |
22 | Correct | 18 ms | 384 KB | Output is correct |
23 | Correct | 5 ms | 384 KB | Output is correct |
24 | Correct | 5 ms | 384 KB | Output is correct |
25 | Correct | 4 ms | 384 KB | Output is correct |
26 | Correct | 5 ms | 384 KB | Output is correct |
27 | Correct | 2805 ms | 384 KB | Output is correct |
28 | Correct | 5 ms | 384 KB | Output is correct |
29 | Correct | 2805 ms | 388 KB | Output is correct |
30 | Correct | 2805 ms | 504 KB | Output is correct |
31 | Correct | 5 ms | 384 KB | Output is correct |
32 | Correct | 2805 ms | 504 KB | Output is correct |
33 | Correct | 5 ms | 384 KB | Output is correct |
34 | Correct | 2805 ms | 480 KB | Output is correct |
35 | Correct | 2805 ms | 504 KB | Output is correct |
36 | Correct | 5 ms | 384 KB | Output is correct |
37 | Correct | 5 ms | 384 KB | Output is correct |
38 | Correct | 2805 ms | 388 KB | Output is correct |
39 | Correct | 5 ms | 384 KB | Output is correct |
40 | Correct | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 4 ms | 384 KB | Output is correct |
8 | Correct | 2805 ms | 504 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 2804 ms | 384 KB | Output is correct |
11 | Correct | 2805 ms | 384 KB | Output is correct |
12 | Correct | 5 ms | 384 KB | Output is correct |
13 | Correct | 2804 ms | 388 KB | Output is correct |
14 | Correct | 5 ms | 384 KB | Output is correct |
15 | Correct | 4 ms | 384 KB | Output is correct |
16 | Correct | 5 ms | 384 KB | Output is correct |
17 | Correct | 4 ms | 384 KB | Output is correct |
18 | Correct | 5 ms | 384 KB | Output is correct |
19 | Correct | 5 ms | 384 KB | Output is correct |
20 | Correct | 4 ms | 384 KB | Output is correct |
21 | Correct | 5 ms | 384 KB | Output is correct |
22 | Correct | 18 ms | 384 KB | Output is correct |
23 | Correct | 5 ms | 384 KB | Output is correct |
24 | Correct | 5 ms | 384 KB | Output is correct |
25 | Correct | 4 ms | 384 KB | Output is correct |
26 | Correct | 5 ms | 384 KB | Output is correct |
27 | Correct | 2805 ms | 384 KB | Output is correct |
28 | Correct | 5 ms | 384 KB | Output is correct |
29 | Correct | 2805 ms | 388 KB | Output is correct |
30 | Correct | 2805 ms | 504 KB | Output is correct |
31 | Correct | 5 ms | 384 KB | Output is correct |
32 | Correct | 2805 ms | 504 KB | Output is correct |
33 | Correct | 5 ms | 384 KB | Output is correct |
34 | Correct | 2805 ms | 480 KB | Output is correct |
35 | Correct | 2805 ms | 504 KB | Output is correct |
36 | Correct | 5 ms | 384 KB | Output is correct |
37 | Correct | 5 ms | 384 KB | Output is correct |
38 | Correct | 2805 ms | 388 KB | Output is correct |
39 | Correct | 5 ms | 384 KB | Output is correct |
40 | Correct | 5 ms | 384 KB | Output is correct |
41 | Correct | 5 ms | 384 KB | Output is correct |
42 | Correct | 5 ms | 384 KB | Output is correct |
43 | Incorrect | 2804 ms | 384 KB | 'impossible' claimed, but there is a solution |
44 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 4 ms | 384 KB | Output is correct |
8 | Correct | 2805 ms | 504 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 2804 ms | 384 KB | Output is correct |
11 | Correct | 2805 ms | 384 KB | Output is correct |
12 | Correct | 5 ms | 384 KB | Output is correct |
13 | Correct | 2804 ms | 388 KB | Output is correct |
14 | Correct | 5 ms | 384 KB | Output is correct |
15 | Correct | 4 ms | 384 KB | Output is correct |
16 | Correct | 5 ms | 384 KB | Output is correct |
17 | Correct | 4 ms | 384 KB | Output is correct |
18 | Correct | 5 ms | 384 KB | Output is correct |
19 | Correct | 5 ms | 384 KB | Output is correct |
20 | Correct | 4 ms | 384 KB | Output is correct |
21 | Correct | 5 ms | 384 KB | Output is correct |
22 | Correct | 18 ms | 384 KB | Output is correct |
23 | Correct | 5 ms | 384 KB | Output is correct |
24 | Correct | 5 ms | 384 KB | Output is correct |
25 | Correct | 4 ms | 384 KB | Output is correct |
26 | Correct | 5 ms | 384 KB | Output is correct |
27 | Correct | 2805 ms | 384 KB | Output is correct |
28 | Correct | 5 ms | 384 KB | Output is correct |
29 | Correct | 2805 ms | 388 KB | Output is correct |
30 | Correct | 2805 ms | 504 KB | Output is correct |
31 | Correct | 5 ms | 384 KB | Output is correct |
32 | Correct | 2805 ms | 504 KB | Output is correct |
33 | Correct | 5 ms | 384 KB | Output is correct |
34 | Correct | 2805 ms | 480 KB | Output is correct |
35 | Correct | 2805 ms | 504 KB | Output is correct |
36 | Correct | 5 ms | 384 KB | Output is correct |
37 | Correct | 5 ms | 384 KB | Output is correct |
38 | Correct | 2805 ms | 388 KB | Output is correct |
39 | Correct | 5 ms | 384 KB | Output is correct |
40 | Correct | 5 ms | 384 KB | Output is correct |
41 | Correct | 5 ms | 384 KB | Output is correct |
42 | Correct | 5 ms | 384 KB | Output is correct |
43 | Incorrect | 2804 ms | 384 KB | 'impossible' claimed, but there is a solution |
44 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 33 ms | 3200 KB | Output is correct |
2 | Correct | 6 ms | 1152 KB | Output is correct |
3 | Correct | 2805 ms | 2424 KB | Output is correct |
4 | Correct | 23 ms | 2304 KB | Output is correct |
5 | Incorrect | 2805 ms | 3388 KB | 'impossible' claimed, but there is a solution |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 4 ms | 384 KB | Output is correct |
8 | Correct | 2805 ms | 504 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 2804 ms | 384 KB | Output is correct |
11 | Correct | 2805 ms | 384 KB | Output is correct |
12 | Correct | 5 ms | 384 KB | Output is correct |
13 | Correct | 2804 ms | 388 KB | Output is correct |
14 | Correct | 5 ms | 384 KB | Output is correct |
15 | Correct | 4 ms | 384 KB | Output is correct |
16 | Correct | 5 ms | 384 KB | Output is correct |
17 | Correct | 4 ms | 384 KB | Output is correct |
18 | Correct | 5 ms | 384 KB | Output is correct |
19 | Correct | 5 ms | 384 KB | Output is correct |
20 | Correct | 4 ms | 384 KB | Output is correct |
21 | Correct | 5 ms | 384 KB | Output is correct |
22 | Correct | 18 ms | 384 KB | Output is correct |
23 | Correct | 5 ms | 384 KB | Output is correct |
24 | Correct | 5 ms | 384 KB | Output is correct |
25 | Correct | 4 ms | 384 KB | Output is correct |
26 | Correct | 5 ms | 384 KB | Output is correct |
27 | Correct | 2805 ms | 384 KB | Output is correct |
28 | Correct | 5 ms | 384 KB | Output is correct |
29 | Correct | 2805 ms | 388 KB | Output is correct |
30 | Correct | 2805 ms | 504 KB | Output is correct |
31 | Correct | 5 ms | 384 KB | Output is correct |
32 | Correct | 2805 ms | 504 KB | Output is correct |
33 | Correct | 5 ms | 384 KB | Output is correct |
34 | Correct | 2805 ms | 480 KB | Output is correct |
35 | Correct | 2805 ms | 504 KB | Output is correct |
36 | Correct | 5 ms | 384 KB | Output is correct |
37 | Correct | 5 ms | 384 KB | Output is correct |
38 | Correct | 2805 ms | 388 KB | Output is correct |
39 | Correct | 5 ms | 384 KB | Output is correct |
40 | Correct | 5 ms | 384 KB | Output is correct |
41 | Correct | 5 ms | 384 KB | Output is correct |
42 | Correct | 5 ms | 384 KB | Output is correct |
43 | Incorrect | 2804 ms | 384 KB | 'impossible' claimed, but there is a solution |
44 | Halted | 0 ms | 0 KB | - |