#include "minerals.h"
#include<bits/stdc++.h>
using namespace std;
bitset<90000> on;
int uwusgi(int x) {
on.flip(x);
return Query(x);
}
#define Query uwusgi
void Solve(int N) {
vector<int> A, B, C(N);
for(int lst = 0, i = 1; i <= 2*N; i++) {
int cc = Query(i);
(cc==lst ? B : A).push_back(i);
lst = cc;
}
// int CC = 0;
for(int b = 0; b < 16; b++) {
int lst = 0;
for(int i = 0; i < N; i++)
if(((i>>b)&1)^on[A[i]])
lst = Query(A[i]);
vector<int> cnt(1<<16), cnto(1<<16);
for(auto i : C) cnt[i]++;
for(int i = 0; i < 1<<b; i++) {
for(int j = 0; j < 1<<(16-b); j++) {
int c = i | (j<<b);
if(c<N)
cnto[i] += j&1;
}
}
for(int i = 0; i < N; i++) {
if(--cnt[C[i]]) {
int qq = Query(B[i]);
if(lst == qq) cnto[C[i]]--;
C[i] |= (lst == qq)<<b;
lst = qq;
} else {
C[i] |= cnto[C[i]]<<b;
}
}
// for(auto i : C) cout << i << " "; cout << endl;
}
for(int i = 0; i < N; i++)
Answer(A[C[i]], B[i]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
712 KB |
Output is correct |
2 |
Correct |
3 ms |
712 KB |
Output is correct |
3 |
Correct |
3 ms |
712 KB |
Output is correct |
4 |
Correct |
3 ms |
736 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
840 KB |
Output is correct |
2 |
Correct |
5 ms |
840 KB |
Output is correct |
3 |
Correct |
6 ms |
968 KB |
Output is correct |
4 |
Correct |
11 ms |
1100 KB |
Output is correct |
5 |
Correct |
13 ms |
1352 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
712 KB |
Output is correct |
2 |
Correct |
3 ms |
712 KB |
Output is correct |
3 |
Correct |
3 ms |
712 KB |
Output is correct |
4 |
Correct |
3 ms |
736 KB |
Output is correct |
5 |
Correct |
4 ms |
840 KB |
Output is correct |
6 |
Correct |
5 ms |
840 KB |
Output is correct |
7 |
Correct |
6 ms |
968 KB |
Output is correct |
8 |
Correct |
11 ms |
1100 KB |
Output is correct |
9 |
Correct |
13 ms |
1352 KB |
Output is correct |
10 |
Correct |
4 ms |
840 KB |
Output is correct |
11 |
Correct |
12 ms |
1224 KB |
Output is correct |
12 |
Correct |
14 ms |
1352 KB |
Output is correct |
13 |
Correct |
14 ms |
1352 KB |
Output is correct |
14 |
Correct |
16 ms |
1296 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
712 KB |
Output is correct |
2 |
Correct |
3 ms |
712 KB |
Output is correct |
3 |
Correct |
3 ms |
712 KB |
Output is correct |
4 |
Correct |
3 ms |
736 KB |
Output is correct |
5 |
Correct |
4 ms |
840 KB |
Output is correct |
6 |
Correct |
5 ms |
840 KB |
Output is correct |
7 |
Correct |
6 ms |
968 KB |
Output is correct |
8 |
Correct |
11 ms |
1100 KB |
Output is correct |
9 |
Correct |
13 ms |
1352 KB |
Output is correct |
10 |
Correct |
4 ms |
840 KB |
Output is correct |
11 |
Correct |
12 ms |
1224 KB |
Output is correct |
12 |
Correct |
14 ms |
1352 KB |
Output is correct |
13 |
Correct |
14 ms |
1352 KB |
Output is correct |
14 |
Correct |
16 ms |
1296 KB |
Output is correct |
15 |
Correct |
31 ms |
2256 KB |
Output is correct |
16 |
Correct |
35 ms |
2260 KB |
Output is correct |
17 |
Correct |
26 ms |
2396 KB |
Output is correct |
18 |
Correct |
27 ms |
2120 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
712 KB |
Output is correct |
2 |
Correct |
3 ms |
712 KB |
Output is correct |
3 |
Correct |
3 ms |
712 KB |
Output is correct |
4 |
Correct |
3 ms |
736 KB |
Output is correct |
5 |
Correct |
4 ms |
840 KB |
Output is correct |
6 |
Correct |
5 ms |
840 KB |
Output is correct |
7 |
Correct |
6 ms |
968 KB |
Output is correct |
8 |
Correct |
11 ms |
1100 KB |
Output is correct |
9 |
Correct |
13 ms |
1352 KB |
Output is correct |
10 |
Correct |
4 ms |
840 KB |
Output is correct |
11 |
Correct |
12 ms |
1224 KB |
Output is correct |
12 |
Correct |
14 ms |
1352 KB |
Output is correct |
13 |
Correct |
14 ms |
1352 KB |
Output is correct |
14 |
Correct |
16 ms |
1296 KB |
Output is correct |
15 |
Correct |
31 ms |
2256 KB |
Output is correct |
16 |
Correct |
35 ms |
2260 KB |
Output is correct |
17 |
Correct |
26 ms |
2396 KB |
Output is correct |
18 |
Correct |
27 ms |
2120 KB |
Output is correct |
19 |
Correct |
38 ms |
2280 KB |
Output is correct |
20 |
Correct |
38 ms |
2340 KB |
Output is correct |
21 |
Correct |
28 ms |
2372 KB |
Output is correct |
22 |
Correct |
27 ms |
2112 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
712 KB |
Output is correct |
2 |
Correct |
3 ms |
712 KB |
Output is correct |
3 |
Correct |
3 ms |
712 KB |
Output is correct |
4 |
Correct |
3 ms |
736 KB |
Output is correct |
5 |
Correct |
4 ms |
840 KB |
Output is correct |
6 |
Correct |
5 ms |
840 KB |
Output is correct |
7 |
Correct |
6 ms |
968 KB |
Output is correct |
8 |
Correct |
11 ms |
1100 KB |
Output is correct |
9 |
Correct |
13 ms |
1352 KB |
Output is correct |
10 |
Correct |
4 ms |
840 KB |
Output is correct |
11 |
Correct |
12 ms |
1224 KB |
Output is correct |
12 |
Correct |
14 ms |
1352 KB |
Output is correct |
13 |
Correct |
14 ms |
1352 KB |
Output is correct |
14 |
Correct |
16 ms |
1296 KB |
Output is correct |
15 |
Correct |
31 ms |
2256 KB |
Output is correct |
16 |
Correct |
35 ms |
2260 KB |
Output is correct |
17 |
Correct |
26 ms |
2396 KB |
Output is correct |
18 |
Correct |
27 ms |
2120 KB |
Output is correct |
19 |
Correct |
38 ms |
2280 KB |
Output is correct |
20 |
Correct |
38 ms |
2340 KB |
Output is correct |
21 |
Correct |
28 ms |
2372 KB |
Output is correct |
22 |
Correct |
27 ms |
2112 KB |
Output is correct |
23 |
Correct |
43 ms |
2256 KB |
Output is correct |
24 |
Correct |
36 ms |
2248 KB |
Output is correct |
25 |
Correct |
28 ms |
2456 KB |
Output is correct |
26 |
Correct |
29 ms |
2224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
712 KB |
Output is correct |
2 |
Correct |
3 ms |
712 KB |
Output is correct |
3 |
Correct |
3 ms |
712 KB |
Output is correct |
4 |
Correct |
3 ms |
736 KB |
Output is correct |
5 |
Correct |
4 ms |
840 KB |
Output is correct |
6 |
Correct |
5 ms |
840 KB |
Output is correct |
7 |
Correct |
6 ms |
968 KB |
Output is correct |
8 |
Correct |
11 ms |
1100 KB |
Output is correct |
9 |
Correct |
13 ms |
1352 KB |
Output is correct |
10 |
Correct |
4 ms |
840 KB |
Output is correct |
11 |
Correct |
12 ms |
1224 KB |
Output is correct |
12 |
Correct |
14 ms |
1352 KB |
Output is correct |
13 |
Correct |
14 ms |
1352 KB |
Output is correct |
14 |
Correct |
16 ms |
1296 KB |
Output is correct |
15 |
Correct |
31 ms |
2256 KB |
Output is correct |
16 |
Correct |
35 ms |
2260 KB |
Output is correct |
17 |
Correct |
26 ms |
2396 KB |
Output is correct |
18 |
Correct |
27 ms |
2120 KB |
Output is correct |
19 |
Correct |
38 ms |
2280 KB |
Output is correct |
20 |
Correct |
38 ms |
2340 KB |
Output is correct |
21 |
Correct |
28 ms |
2372 KB |
Output is correct |
22 |
Correct |
27 ms |
2112 KB |
Output is correct |
23 |
Correct |
43 ms |
2256 KB |
Output is correct |
24 |
Correct |
36 ms |
2248 KB |
Output is correct |
25 |
Correct |
28 ms |
2456 KB |
Output is correct |
26 |
Correct |
29 ms |
2224 KB |
Output is correct |
27 |
Incorrect |
34 ms |
2404 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
712 KB |
Output is correct |
2 |
Correct |
3 ms |
712 KB |
Output is correct |
3 |
Correct |
3 ms |
712 KB |
Output is correct |
4 |
Correct |
3 ms |
736 KB |
Output is correct |
5 |
Correct |
4 ms |
840 KB |
Output is correct |
6 |
Correct |
5 ms |
840 KB |
Output is correct |
7 |
Correct |
6 ms |
968 KB |
Output is correct |
8 |
Correct |
11 ms |
1100 KB |
Output is correct |
9 |
Correct |
13 ms |
1352 KB |
Output is correct |
10 |
Correct |
4 ms |
840 KB |
Output is correct |
11 |
Correct |
12 ms |
1224 KB |
Output is correct |
12 |
Correct |
14 ms |
1352 KB |
Output is correct |
13 |
Correct |
14 ms |
1352 KB |
Output is correct |
14 |
Correct |
16 ms |
1296 KB |
Output is correct |
15 |
Correct |
31 ms |
2256 KB |
Output is correct |
16 |
Correct |
35 ms |
2260 KB |
Output is correct |
17 |
Correct |
26 ms |
2396 KB |
Output is correct |
18 |
Correct |
27 ms |
2120 KB |
Output is correct |
19 |
Correct |
38 ms |
2280 KB |
Output is correct |
20 |
Correct |
38 ms |
2340 KB |
Output is correct |
21 |
Correct |
28 ms |
2372 KB |
Output is correct |
22 |
Correct |
27 ms |
2112 KB |
Output is correct |
23 |
Correct |
43 ms |
2256 KB |
Output is correct |
24 |
Correct |
36 ms |
2248 KB |
Output is correct |
25 |
Correct |
28 ms |
2456 KB |
Output is correct |
26 |
Correct |
29 ms |
2224 KB |
Output is correct |
27 |
Incorrect |
34 ms |
2404 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
712 KB |
Output is correct |
2 |
Correct |
3 ms |
712 KB |
Output is correct |
3 |
Correct |
3 ms |
712 KB |
Output is correct |
4 |
Correct |
3 ms |
736 KB |
Output is correct |
5 |
Correct |
4 ms |
840 KB |
Output is correct |
6 |
Correct |
5 ms |
840 KB |
Output is correct |
7 |
Correct |
6 ms |
968 KB |
Output is correct |
8 |
Correct |
11 ms |
1100 KB |
Output is correct |
9 |
Correct |
13 ms |
1352 KB |
Output is correct |
10 |
Correct |
4 ms |
840 KB |
Output is correct |
11 |
Correct |
12 ms |
1224 KB |
Output is correct |
12 |
Correct |
14 ms |
1352 KB |
Output is correct |
13 |
Correct |
14 ms |
1352 KB |
Output is correct |
14 |
Correct |
16 ms |
1296 KB |
Output is correct |
15 |
Correct |
31 ms |
2256 KB |
Output is correct |
16 |
Correct |
35 ms |
2260 KB |
Output is correct |
17 |
Correct |
26 ms |
2396 KB |
Output is correct |
18 |
Correct |
27 ms |
2120 KB |
Output is correct |
19 |
Correct |
38 ms |
2280 KB |
Output is correct |
20 |
Correct |
38 ms |
2340 KB |
Output is correct |
21 |
Correct |
28 ms |
2372 KB |
Output is correct |
22 |
Correct |
27 ms |
2112 KB |
Output is correct |
23 |
Correct |
43 ms |
2256 KB |
Output is correct |
24 |
Correct |
36 ms |
2248 KB |
Output is correct |
25 |
Correct |
28 ms |
2456 KB |
Output is correct |
26 |
Correct |
29 ms |
2224 KB |
Output is correct |
27 |
Incorrect |
34 ms |
2404 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |