#include "minerals.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define x first
#define y second
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
#pragma GCC optimize("unroll-loops")
#define shandom_ruffle(a, b) shuffle(a, b, rng)
#define vi vector<int>
#define vl vector<ll>
#define popcnt __builtin_popcount
#define popcntll __builtin_popcountll
#define all(a) begin(a),end(a)
using namespace std;
using namespace __gnu_pbds;
using ll=long long;
using ull=unsigned long long;
using ld=long double;
int MOD=1000000007;
int MOD2=998244353;
vector<int> bases;
const ll LLINF=1ll<<60;
const char en='\n';
int laa=0;
map<int,int> im;
int query(int a)
{
int z=Query(a);
if (z==laa) return 1;
else
{
if (!im[a]) ++laa,im[a]=1;
else --laa,im[a]=0;
return 0;
}
}
void Solve(int N) {
vi v1,v2;
for (int i=1;i<=2*N;++i)
{
int u=query(i);
if (u==1) v2.pb(i),Query(i);
else v1.pb(i);
//cout<<i<<' '<<u<<endl;
}
/*for (auto a: v1) cout<<a<<' ';
cout<<endl;
for (auto a: v2) cout<<a<<' ';
cout<<endl;*/
for (auto a: v1) query(a);
vi ind(N);
for (int b=14;b>=0;--b)
{
for (int i=0;i<N;++i) if (i&(1<<b)) query(v2[i]);
for (int i=0;i<N;++i)
{
if (query(v1[i])) ind[i]+=1<<b;
query(v1[i]);
}
for (int i=0;i<N;++i) if (i&(1<<b)) query(v2[i]);
}
/*for (auto a: ind) cout<<a<<' ';
cout<<endl;*/
for (int i=0;i<N;++i) Answer(v1[i],v2[ind[i]]);
}
# |
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 |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
512 KB |
Output is correct |
2 |
Correct |
10 ms |
640 KB |
Output is correct |
3 |
Correct |
20 ms |
1024 KB |
Output is correct |
4 |
Correct |
44 ms |
1412 KB |
Output is correct |
5 |
Correct |
94 ms |
2296 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 |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
512 KB |
Output is correct |
6 |
Correct |
10 ms |
640 KB |
Output is correct |
7 |
Correct |
20 ms |
1024 KB |
Output is correct |
8 |
Correct |
44 ms |
1412 KB |
Output is correct |
9 |
Correct |
94 ms |
2296 KB |
Output is correct |
10 |
Correct |
5 ms |
512 KB |
Output is correct |
11 |
Correct |
55 ms |
1664 KB |
Output is correct |
12 |
Correct |
86 ms |
2424 KB |
Output is correct |
13 |
Correct |
87 ms |
2424 KB |
Output is correct |
14 |
Correct |
86 ms |
2296 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 |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
512 KB |
Output is correct |
6 |
Correct |
10 ms |
640 KB |
Output is correct |
7 |
Correct |
20 ms |
1024 KB |
Output is correct |
8 |
Correct |
44 ms |
1412 KB |
Output is correct |
9 |
Correct |
94 ms |
2296 KB |
Output is correct |
10 |
Correct |
5 ms |
512 KB |
Output is correct |
11 |
Correct |
55 ms |
1664 KB |
Output is correct |
12 |
Correct |
86 ms |
2424 KB |
Output is correct |
13 |
Correct |
87 ms |
2424 KB |
Output is correct |
14 |
Correct |
86 ms |
2296 KB |
Output is correct |
15 |
Incorrect |
139 ms |
5236 KB |
Wrong Answer [2] |
16 |
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 |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
512 KB |
Output is correct |
6 |
Correct |
10 ms |
640 KB |
Output is correct |
7 |
Correct |
20 ms |
1024 KB |
Output is correct |
8 |
Correct |
44 ms |
1412 KB |
Output is correct |
9 |
Correct |
94 ms |
2296 KB |
Output is correct |
10 |
Correct |
5 ms |
512 KB |
Output is correct |
11 |
Correct |
55 ms |
1664 KB |
Output is correct |
12 |
Correct |
86 ms |
2424 KB |
Output is correct |
13 |
Correct |
87 ms |
2424 KB |
Output is correct |
14 |
Correct |
86 ms |
2296 KB |
Output is correct |
15 |
Incorrect |
139 ms |
5236 KB |
Wrong Answer [2] |
16 |
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 |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
512 KB |
Output is correct |
6 |
Correct |
10 ms |
640 KB |
Output is correct |
7 |
Correct |
20 ms |
1024 KB |
Output is correct |
8 |
Correct |
44 ms |
1412 KB |
Output is correct |
9 |
Correct |
94 ms |
2296 KB |
Output is correct |
10 |
Correct |
5 ms |
512 KB |
Output is correct |
11 |
Correct |
55 ms |
1664 KB |
Output is correct |
12 |
Correct |
86 ms |
2424 KB |
Output is correct |
13 |
Correct |
87 ms |
2424 KB |
Output is correct |
14 |
Correct |
86 ms |
2296 KB |
Output is correct |
15 |
Incorrect |
139 ms |
5236 KB |
Wrong Answer [2] |
16 |
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 |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
512 KB |
Output is correct |
6 |
Correct |
10 ms |
640 KB |
Output is correct |
7 |
Correct |
20 ms |
1024 KB |
Output is correct |
8 |
Correct |
44 ms |
1412 KB |
Output is correct |
9 |
Correct |
94 ms |
2296 KB |
Output is correct |
10 |
Correct |
5 ms |
512 KB |
Output is correct |
11 |
Correct |
55 ms |
1664 KB |
Output is correct |
12 |
Correct |
86 ms |
2424 KB |
Output is correct |
13 |
Correct |
87 ms |
2424 KB |
Output is correct |
14 |
Correct |
86 ms |
2296 KB |
Output is correct |
15 |
Incorrect |
139 ms |
5236 KB |
Wrong Answer [2] |
16 |
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 |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
512 KB |
Output is correct |
6 |
Correct |
10 ms |
640 KB |
Output is correct |
7 |
Correct |
20 ms |
1024 KB |
Output is correct |
8 |
Correct |
44 ms |
1412 KB |
Output is correct |
9 |
Correct |
94 ms |
2296 KB |
Output is correct |
10 |
Correct |
5 ms |
512 KB |
Output is correct |
11 |
Correct |
55 ms |
1664 KB |
Output is correct |
12 |
Correct |
86 ms |
2424 KB |
Output is correct |
13 |
Correct |
87 ms |
2424 KB |
Output is correct |
14 |
Correct |
86 ms |
2296 KB |
Output is correct |
15 |
Incorrect |
139 ms |
5236 KB |
Wrong Answer [2] |
16 |
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 |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
512 KB |
Output is correct |
6 |
Correct |
10 ms |
640 KB |
Output is correct |
7 |
Correct |
20 ms |
1024 KB |
Output is correct |
8 |
Correct |
44 ms |
1412 KB |
Output is correct |
9 |
Correct |
94 ms |
2296 KB |
Output is correct |
10 |
Correct |
5 ms |
512 KB |
Output is correct |
11 |
Correct |
55 ms |
1664 KB |
Output is correct |
12 |
Correct |
86 ms |
2424 KB |
Output is correct |
13 |
Correct |
87 ms |
2424 KB |
Output is correct |
14 |
Correct |
86 ms |
2296 KB |
Output is correct |
15 |
Incorrect |
139 ms |
5236 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |