#include "minerals.h"
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define sz(a) ((ll)(a).size())
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
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++) (flip(i)?A: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;}
shuffle(L.begin(), L.end(), rng);
vector <ll> left, right;
for (ll i=0; i<max(1.0, 0.35*n); 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);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |