#include "minerals.h"
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define sz(a) ((ll)(a).size())
using namespace std;
void Solve(int n)
{
ll crr=0;
vector <ll> A, B, a(n*2+1, 0);
auto flip=[&](ll idx)
{
ll x=Query(idx)-crr;
crr+=x, a[idx]^=1; return x;
};
for (ll i=1; i<=n*2; i++)
{
if (flip(i)) A.pb(i);
else B.pb(i);
}
function <void(vector <ll>, vector <ll>, bool)>
solve=[&](vector <ll> L, vector <ll> R, bool cr)
{
ll n=sz(L);
if (n==1) {Answer(L[0], R[0]); return;}
vector <ll> left, right;
for (ll i=0; i<n/2; i++) flip(L[i]);
for (ll i:R) (a[i]^(a[i]+flip(i))^cr?right:left).pb(i);
solve(vector <ll> (L.begin(), L.begin()+n/2), left, cr^1);
solve(vector <ll> (L.begin()+n/2, L.end()), right, cr);
}; solve(A, B, 1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
600 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
600 KB |
Output is correct |
3 |
Correct |
3 ms |
696 KB |
Output is correct |
4 |
Correct |
5 ms |
1268 KB |
Output is correct |
5 |
Correct |
10 ms |
1880 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
600 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
600 KB |
Output is correct |
7 |
Correct |
3 ms |
696 KB |
Output is correct |
8 |
Correct |
5 ms |
1268 KB |
Output is correct |
9 |
Correct |
10 ms |
1880 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
1368 KB |
Output is correct |
12 |
Correct |
9 ms |
2136 KB |
Output is correct |
13 |
Correct |
7 ms |
2288 KB |
Output is correct |
14 |
Correct |
7 ms |
2136 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
600 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
600 KB |
Output is correct |
7 |
Correct |
3 ms |
696 KB |
Output is correct |
8 |
Correct |
5 ms |
1268 KB |
Output is correct |
9 |
Correct |
10 ms |
1880 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
1368 KB |
Output is correct |
12 |
Correct |
9 ms |
2136 KB |
Output is correct |
13 |
Correct |
7 ms |
2288 KB |
Output is correct |
14 |
Correct |
7 ms |
2136 KB |
Output is correct |
15 |
Correct |
24 ms |
4800 KB |
Output is correct |
16 |
Correct |
26 ms |
4744 KB |
Output is correct |
17 |
Correct |
19 ms |
4548 KB |
Output is correct |
18 |
Correct |
22 ms |
4624 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
600 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
600 KB |
Output is correct |
7 |
Correct |
3 ms |
696 KB |
Output is correct |
8 |
Correct |
5 ms |
1268 KB |
Output is correct |
9 |
Correct |
10 ms |
1880 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
1368 KB |
Output is correct |
12 |
Correct |
9 ms |
2136 KB |
Output is correct |
13 |
Correct |
7 ms |
2288 KB |
Output is correct |
14 |
Correct |
7 ms |
2136 KB |
Output is correct |
15 |
Correct |
24 ms |
4800 KB |
Output is correct |
16 |
Correct |
26 ms |
4744 KB |
Output is correct |
17 |
Correct |
19 ms |
4548 KB |
Output is correct |
18 |
Correct |
22 ms |
4624 KB |
Output is correct |
19 |
Correct |
25 ms |
4692 KB |
Output is correct |
20 |
Correct |
25 ms |
4832 KB |
Output is correct |
21 |
Correct |
20 ms |
4916 KB |
Output is correct |
22 |
Correct |
20 ms |
4768 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
600 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
600 KB |
Output is correct |
7 |
Correct |
3 ms |
696 KB |
Output is correct |
8 |
Correct |
5 ms |
1268 KB |
Output is correct |
9 |
Correct |
10 ms |
1880 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
1368 KB |
Output is correct |
12 |
Correct |
9 ms |
2136 KB |
Output is correct |
13 |
Correct |
7 ms |
2288 KB |
Output is correct |
14 |
Correct |
7 ms |
2136 KB |
Output is correct |
15 |
Correct |
24 ms |
4800 KB |
Output is correct |
16 |
Correct |
26 ms |
4744 KB |
Output is correct |
17 |
Correct |
19 ms |
4548 KB |
Output is correct |
18 |
Correct |
22 ms |
4624 KB |
Output is correct |
19 |
Correct |
25 ms |
4692 KB |
Output is correct |
20 |
Correct |
25 ms |
4832 KB |
Output is correct |
21 |
Correct |
20 ms |
4916 KB |
Output is correct |
22 |
Correct |
20 ms |
4768 KB |
Output is correct |
23 |
Correct |
32 ms |
4836 KB |
Output is correct |
24 |
Correct |
25 ms |
4840 KB |
Output is correct |
25 |
Correct |
20 ms |
5092 KB |
Output is correct |
26 |
Correct |
19 ms |
4604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
600 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
600 KB |
Output is correct |
7 |
Correct |
3 ms |
696 KB |
Output is correct |
8 |
Correct |
5 ms |
1268 KB |
Output is correct |
9 |
Correct |
10 ms |
1880 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
1368 KB |
Output is correct |
12 |
Correct |
9 ms |
2136 KB |
Output is correct |
13 |
Correct |
7 ms |
2288 KB |
Output is correct |
14 |
Correct |
7 ms |
2136 KB |
Output is correct |
15 |
Correct |
24 ms |
4800 KB |
Output is correct |
16 |
Correct |
26 ms |
4744 KB |
Output is correct |
17 |
Correct |
19 ms |
4548 KB |
Output is correct |
18 |
Correct |
22 ms |
4624 KB |
Output is correct |
19 |
Correct |
25 ms |
4692 KB |
Output is correct |
20 |
Correct |
25 ms |
4832 KB |
Output is correct |
21 |
Correct |
20 ms |
4916 KB |
Output is correct |
22 |
Correct |
20 ms |
4768 KB |
Output is correct |
23 |
Correct |
32 ms |
4836 KB |
Output is correct |
24 |
Correct |
25 ms |
4840 KB |
Output is correct |
25 |
Correct |
20 ms |
5092 KB |
Output is correct |
26 |
Correct |
19 ms |
4604 KB |
Output is correct |
27 |
Incorrect |
26 ms |
5104 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
600 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
600 KB |
Output is correct |
7 |
Correct |
3 ms |
696 KB |
Output is correct |
8 |
Correct |
5 ms |
1268 KB |
Output is correct |
9 |
Correct |
10 ms |
1880 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
1368 KB |
Output is correct |
12 |
Correct |
9 ms |
2136 KB |
Output is correct |
13 |
Correct |
7 ms |
2288 KB |
Output is correct |
14 |
Correct |
7 ms |
2136 KB |
Output is correct |
15 |
Correct |
24 ms |
4800 KB |
Output is correct |
16 |
Correct |
26 ms |
4744 KB |
Output is correct |
17 |
Correct |
19 ms |
4548 KB |
Output is correct |
18 |
Correct |
22 ms |
4624 KB |
Output is correct |
19 |
Correct |
25 ms |
4692 KB |
Output is correct |
20 |
Correct |
25 ms |
4832 KB |
Output is correct |
21 |
Correct |
20 ms |
4916 KB |
Output is correct |
22 |
Correct |
20 ms |
4768 KB |
Output is correct |
23 |
Correct |
32 ms |
4836 KB |
Output is correct |
24 |
Correct |
25 ms |
4840 KB |
Output is correct |
25 |
Correct |
20 ms |
5092 KB |
Output is correct |
26 |
Correct |
19 ms |
4604 KB |
Output is correct |
27 |
Incorrect |
26 ms |
5104 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
600 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
600 KB |
Output is correct |
7 |
Correct |
3 ms |
696 KB |
Output is correct |
8 |
Correct |
5 ms |
1268 KB |
Output is correct |
9 |
Correct |
10 ms |
1880 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
1368 KB |
Output is correct |
12 |
Correct |
9 ms |
2136 KB |
Output is correct |
13 |
Correct |
7 ms |
2288 KB |
Output is correct |
14 |
Correct |
7 ms |
2136 KB |
Output is correct |
15 |
Correct |
24 ms |
4800 KB |
Output is correct |
16 |
Correct |
26 ms |
4744 KB |
Output is correct |
17 |
Correct |
19 ms |
4548 KB |
Output is correct |
18 |
Correct |
22 ms |
4624 KB |
Output is correct |
19 |
Correct |
25 ms |
4692 KB |
Output is correct |
20 |
Correct |
25 ms |
4832 KB |
Output is correct |
21 |
Correct |
20 ms |
4916 KB |
Output is correct |
22 |
Correct |
20 ms |
4768 KB |
Output is correct |
23 |
Correct |
32 ms |
4836 KB |
Output is correct |
24 |
Correct |
25 ms |
4840 KB |
Output is correct |
25 |
Correct |
20 ms |
5092 KB |
Output is correct |
26 |
Correct |
19 ms |
4604 KB |
Output is correct |
27 |
Incorrect |
26 ms |
5104 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |