#include <bits/stdc++.h>
using namespace std;
using ll = long long ;
#define pb emplace_back
#define AI(i) begin(i), end(i)
template<class T> bool chmin(T &a, T b) { return b < a && (a = b, true); }
template<class T> bool chmax(T &a, T b) { return a < b && (a = b, true); }
#ifdef KEV
#define DE(args...) kout("[ " + string(#args) + " ] = ", args)
void kout() { cerr << endl; }
template<class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ', kout(b...); }
template<class T> void debug(T l, T r) { while (l != r) cerr << *l << " \n"[next(l) == r], ++l; }
#else
#define DE(...) 0
#define debug(...) 0
#endif
#include "minerals.h"
int qry(int ind) { return Query(ind+1); }
void ans(int a, int b) { Answer(a+1, b+1); }
void Solve(int N) {
vector<int> res(N + N);
int M = N + N;
auto isin = [&](int id) {
static int lst = 0;
int now = qry(id);
return exchange(lst, now) == now;
};
for (int d = 0;1<<d < M;++d) {
for (int i = 0;i < M;++i) if (i>>d&1)
if (isin(i)) res[i] |= 1<<d;
for (int i = 0;i < M;++i) if (~i>>d&1) {
if (isin(i)) res[i] |= 1<<d;
isin(i);
}
for (int i = 0;i < M;++i) if (i>>d&1)
if (isin(i)) res[i] |= 1<<d;
}
for (int i = 0;i < M;++i)
if (res[i] < i)
ans(i, res[i]);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
364 KB |
Output is correct |
3 |
Correct |
4 ms |
492 KB |
Output is correct |
4 |
Correct |
9 ms |
768 KB |
Output is correct |
5 |
Correct |
14 ms |
876 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
364 KB |
Output is correct |
7 |
Correct |
4 ms |
492 KB |
Output is correct |
8 |
Correct |
9 ms |
768 KB |
Output is correct |
9 |
Correct |
14 ms |
876 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
11 ms |
748 KB |
Output is correct |
12 |
Correct |
17 ms |
876 KB |
Output is correct |
13 |
Correct |
13 ms |
876 KB |
Output is correct |
14 |
Correct |
11 ms |
876 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
364 KB |
Output is correct |
7 |
Correct |
4 ms |
492 KB |
Output is correct |
8 |
Correct |
9 ms |
768 KB |
Output is correct |
9 |
Correct |
14 ms |
876 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
11 ms |
748 KB |
Output is correct |
12 |
Correct |
17 ms |
876 KB |
Output is correct |
13 |
Correct |
13 ms |
876 KB |
Output is correct |
14 |
Correct |
11 ms |
876 KB |
Output is correct |
15 |
Incorrect |
23 ms |
1516 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
364 KB |
Output is correct |
7 |
Correct |
4 ms |
492 KB |
Output is correct |
8 |
Correct |
9 ms |
768 KB |
Output is correct |
9 |
Correct |
14 ms |
876 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
11 ms |
748 KB |
Output is correct |
12 |
Correct |
17 ms |
876 KB |
Output is correct |
13 |
Correct |
13 ms |
876 KB |
Output is correct |
14 |
Correct |
11 ms |
876 KB |
Output is correct |
15 |
Incorrect |
23 ms |
1516 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
364 KB |
Output is correct |
7 |
Correct |
4 ms |
492 KB |
Output is correct |
8 |
Correct |
9 ms |
768 KB |
Output is correct |
9 |
Correct |
14 ms |
876 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
11 ms |
748 KB |
Output is correct |
12 |
Correct |
17 ms |
876 KB |
Output is correct |
13 |
Correct |
13 ms |
876 KB |
Output is correct |
14 |
Correct |
11 ms |
876 KB |
Output is correct |
15 |
Incorrect |
23 ms |
1516 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
364 KB |
Output is correct |
7 |
Correct |
4 ms |
492 KB |
Output is correct |
8 |
Correct |
9 ms |
768 KB |
Output is correct |
9 |
Correct |
14 ms |
876 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
11 ms |
748 KB |
Output is correct |
12 |
Correct |
17 ms |
876 KB |
Output is correct |
13 |
Correct |
13 ms |
876 KB |
Output is correct |
14 |
Correct |
11 ms |
876 KB |
Output is correct |
15 |
Incorrect |
23 ms |
1516 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
364 KB |
Output is correct |
7 |
Correct |
4 ms |
492 KB |
Output is correct |
8 |
Correct |
9 ms |
768 KB |
Output is correct |
9 |
Correct |
14 ms |
876 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
11 ms |
748 KB |
Output is correct |
12 |
Correct |
17 ms |
876 KB |
Output is correct |
13 |
Correct |
13 ms |
876 KB |
Output is correct |
14 |
Correct |
11 ms |
876 KB |
Output is correct |
15 |
Incorrect |
23 ms |
1516 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
364 KB |
Output is correct |
7 |
Correct |
4 ms |
492 KB |
Output is correct |
8 |
Correct |
9 ms |
768 KB |
Output is correct |
9 |
Correct |
14 ms |
876 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
11 ms |
748 KB |
Output is correct |
12 |
Correct |
17 ms |
876 KB |
Output is correct |
13 |
Correct |
13 ms |
876 KB |
Output is correct |
14 |
Correct |
11 ms |
876 KB |
Output is correct |
15 |
Incorrect |
23 ms |
1516 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |