#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
int n;
int cur = 0;
int isbase[90000];
set<int> taken;
bool in(int i){
return (taken.find(i) != taken.end());
}
int query(int i){
if(!in(i)) taken.insert(i);
else taken.erase(i);
cur = Query(i);
return cur;
}
vector<int> base;
vector<int> other;
int otherVal[90000];
void modifyBase(int bit){
for(int i = 0;i < n;i++){
if(i & (1 << bit)){
if(!in(base[i])) query(base[i]);
}
else{
if(in(base[i])) query(base[i]);
}
}
//cout << bit << ": ";
//for(int x : taken) cout << x << " ";
//cout << "\n";
}
bool check(int i){
int pre = cur;
int x = other[i];
query(x);
if(cur == pre) return true;
else return false;
return true;
}
void Solve(int N){
n = N;
for(int i = 1;i <= 2*n;i++){
int pre = cur;
int C = query(i);
if(pre == C) isbase[i] = 0;
else isbase[i] = 1;
if(isbase[i]) base.push_back(i);
else other.push_back(i);
}
for(int bit = 0;(1 << bit) < n;bit++){
modifyBase(bit);
for(int i = 0;i < n;i++){
if(check(i)){
otherVal[i] += (1 << bit);
}
}
}
for(int i = 0;i < n;i++){
int B = base[otherVal[i]];
int O = other[i];
//cout << B << " " << O << "\n";
Answer(B, O);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
512 KB |
Output is correct |
2 |
Correct |
7 ms |
640 KB |
Output is correct |
3 |
Correct |
14 ms |
896 KB |
Output is correct |
4 |
Correct |
31 ms |
1408 KB |
Output is correct |
5 |
Correct |
67 ms |
2424 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
512 KB |
Output is correct |
6 |
Correct |
7 ms |
640 KB |
Output is correct |
7 |
Correct |
14 ms |
896 KB |
Output is correct |
8 |
Correct |
31 ms |
1408 KB |
Output is correct |
9 |
Correct |
67 ms |
2424 KB |
Output is correct |
10 |
Correct |
4 ms |
512 KB |
Output is correct |
11 |
Correct |
48 ms |
1784 KB |
Output is correct |
12 |
Correct |
78 ms |
2552 KB |
Output is correct |
13 |
Correct |
73 ms |
2476 KB |
Output is correct |
14 |
Correct |
67 ms |
2424 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
512 KB |
Output is correct |
6 |
Correct |
7 ms |
640 KB |
Output is correct |
7 |
Correct |
14 ms |
896 KB |
Output is correct |
8 |
Correct |
31 ms |
1408 KB |
Output is correct |
9 |
Correct |
67 ms |
2424 KB |
Output is correct |
10 |
Correct |
4 ms |
512 KB |
Output is correct |
11 |
Correct |
48 ms |
1784 KB |
Output is correct |
12 |
Correct |
78 ms |
2552 KB |
Output is correct |
13 |
Correct |
73 ms |
2476 KB |
Output is correct |
14 |
Correct |
67 ms |
2424 KB |
Output is correct |
15 |
Correct |
233 ms |
5876 KB |
Output is correct |
16 |
Correct |
223 ms |
5876 KB |
Output is correct |
17 |
Correct |
218 ms |
5868 KB |
Output is correct |
18 |
Correct |
221 ms |
5748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
512 KB |
Output is correct |
6 |
Correct |
7 ms |
640 KB |
Output is correct |
7 |
Correct |
14 ms |
896 KB |
Output is correct |
8 |
Correct |
31 ms |
1408 KB |
Output is correct |
9 |
Correct |
67 ms |
2424 KB |
Output is correct |
10 |
Correct |
4 ms |
512 KB |
Output is correct |
11 |
Correct |
48 ms |
1784 KB |
Output is correct |
12 |
Correct |
78 ms |
2552 KB |
Output is correct |
13 |
Correct |
73 ms |
2476 KB |
Output is correct |
14 |
Correct |
67 ms |
2424 KB |
Output is correct |
15 |
Correct |
233 ms |
5876 KB |
Output is correct |
16 |
Correct |
223 ms |
5876 KB |
Output is correct |
17 |
Correct |
218 ms |
5868 KB |
Output is correct |
18 |
Correct |
221 ms |
5748 KB |
Output is correct |
19 |
Incorrect |
241 ms |
5740 KB |
Wrong Answer [2] |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
512 KB |
Output is correct |
6 |
Correct |
7 ms |
640 KB |
Output is correct |
7 |
Correct |
14 ms |
896 KB |
Output is correct |
8 |
Correct |
31 ms |
1408 KB |
Output is correct |
9 |
Correct |
67 ms |
2424 KB |
Output is correct |
10 |
Correct |
4 ms |
512 KB |
Output is correct |
11 |
Correct |
48 ms |
1784 KB |
Output is correct |
12 |
Correct |
78 ms |
2552 KB |
Output is correct |
13 |
Correct |
73 ms |
2476 KB |
Output is correct |
14 |
Correct |
67 ms |
2424 KB |
Output is correct |
15 |
Correct |
233 ms |
5876 KB |
Output is correct |
16 |
Correct |
223 ms |
5876 KB |
Output is correct |
17 |
Correct |
218 ms |
5868 KB |
Output is correct |
18 |
Correct |
221 ms |
5748 KB |
Output is correct |
19 |
Incorrect |
241 ms |
5740 KB |
Wrong Answer [2] |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
512 KB |
Output is correct |
6 |
Correct |
7 ms |
640 KB |
Output is correct |
7 |
Correct |
14 ms |
896 KB |
Output is correct |
8 |
Correct |
31 ms |
1408 KB |
Output is correct |
9 |
Correct |
67 ms |
2424 KB |
Output is correct |
10 |
Correct |
4 ms |
512 KB |
Output is correct |
11 |
Correct |
48 ms |
1784 KB |
Output is correct |
12 |
Correct |
78 ms |
2552 KB |
Output is correct |
13 |
Correct |
73 ms |
2476 KB |
Output is correct |
14 |
Correct |
67 ms |
2424 KB |
Output is correct |
15 |
Correct |
233 ms |
5876 KB |
Output is correct |
16 |
Correct |
223 ms |
5876 KB |
Output is correct |
17 |
Correct |
218 ms |
5868 KB |
Output is correct |
18 |
Correct |
221 ms |
5748 KB |
Output is correct |
19 |
Incorrect |
241 ms |
5740 KB |
Wrong Answer [2] |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
512 KB |
Output is correct |
6 |
Correct |
7 ms |
640 KB |
Output is correct |
7 |
Correct |
14 ms |
896 KB |
Output is correct |
8 |
Correct |
31 ms |
1408 KB |
Output is correct |
9 |
Correct |
67 ms |
2424 KB |
Output is correct |
10 |
Correct |
4 ms |
512 KB |
Output is correct |
11 |
Correct |
48 ms |
1784 KB |
Output is correct |
12 |
Correct |
78 ms |
2552 KB |
Output is correct |
13 |
Correct |
73 ms |
2476 KB |
Output is correct |
14 |
Correct |
67 ms |
2424 KB |
Output is correct |
15 |
Correct |
233 ms |
5876 KB |
Output is correct |
16 |
Correct |
223 ms |
5876 KB |
Output is correct |
17 |
Correct |
218 ms |
5868 KB |
Output is correct |
18 |
Correct |
221 ms |
5748 KB |
Output is correct |
19 |
Incorrect |
241 ms |
5740 KB |
Wrong Answer [2] |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
512 KB |
Output is correct |
6 |
Correct |
7 ms |
640 KB |
Output is correct |
7 |
Correct |
14 ms |
896 KB |
Output is correct |
8 |
Correct |
31 ms |
1408 KB |
Output is correct |
9 |
Correct |
67 ms |
2424 KB |
Output is correct |
10 |
Correct |
4 ms |
512 KB |
Output is correct |
11 |
Correct |
48 ms |
1784 KB |
Output is correct |
12 |
Correct |
78 ms |
2552 KB |
Output is correct |
13 |
Correct |
73 ms |
2476 KB |
Output is correct |
14 |
Correct |
67 ms |
2424 KB |
Output is correct |
15 |
Correct |
233 ms |
5876 KB |
Output is correct |
16 |
Correct |
223 ms |
5876 KB |
Output is correct |
17 |
Correct |
218 ms |
5868 KB |
Output is correct |
18 |
Correct |
221 ms |
5748 KB |
Output is correct |
19 |
Incorrect |
241 ms |
5740 KB |
Wrong Answer [2] |
20 |
Halted |
0 ms |
0 KB |
- |