#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
long long nn[2],a[2][43069],sq[43069];
bitset<43069> vtd;
void Solve(int n)
{
long long i,j,k,l=0,c,e;
for(i=1;i<=n*2;i++)
{
k=Query(i);
a[k==l][nn[k==l]]=i;
nn[k==l]++;
l=k;
}
for(i=0;i<n;i++)
{
vtd[i]=1;
}
for(i=0;1ll<<i<n;i++)
{
c=0;
for(j=0;j<n;j++)
{
c+=(j>>i&1)!=vtd[j];
}
e=n-c<c;
for(j=0;j<n;j++)
{
if(((j>>i&1)^e)!=vtd[j])
{
vtd[j]=!vtd[j];
l=Query(a[0][j]);
}
}
for(j=0;j<n;j++)
{
k=Query(a[1][j]);
sq[j]|=(k==l^e)<<i;
l=k;
}
}
for(i=0;i<n;i++)
{
Answer(a[1][i],a[0][sq[i]]);
}
}
Compilation message
minerals.cpp: In function 'void Solve(int)':
minerals.cpp:43:13: warning: suggest parentheses around comparison in operand of '^' [-Wparentheses]
43 | sq[j]|=(k==l^e)<<i;
| ~^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
512 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
3 ms |
512 KB |
Output is correct |
4 |
Correct |
5 ms |
768 KB |
Output is correct |
5 |
Correct |
10 ms |
1152 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
512 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
3 ms |
512 KB |
Output is correct |
8 |
Correct |
5 ms |
768 KB |
Output is correct |
9 |
Correct |
10 ms |
1152 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
7 ms |
896 KB |
Output is correct |
12 |
Correct |
10 ms |
1152 KB |
Output is correct |
13 |
Correct |
8 ms |
1152 KB |
Output is correct |
14 |
Correct |
8 ms |
1152 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
512 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
3 ms |
512 KB |
Output is correct |
8 |
Correct |
5 ms |
768 KB |
Output is correct |
9 |
Correct |
10 ms |
1152 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
7 ms |
896 KB |
Output is correct |
12 |
Correct |
10 ms |
1152 KB |
Output is correct |
13 |
Correct |
8 ms |
1152 KB |
Output is correct |
14 |
Correct |
8 ms |
1152 KB |
Output is correct |
15 |
Correct |
27 ms |
2424 KB |
Output is correct |
16 |
Correct |
28 ms |
2424 KB |
Output is correct |
17 |
Correct |
21 ms |
2424 KB |
Output is correct |
18 |
Correct |
22 ms |
2304 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
512 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
3 ms |
512 KB |
Output is correct |
8 |
Correct |
5 ms |
768 KB |
Output is correct |
9 |
Correct |
10 ms |
1152 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
7 ms |
896 KB |
Output is correct |
12 |
Correct |
10 ms |
1152 KB |
Output is correct |
13 |
Correct |
8 ms |
1152 KB |
Output is correct |
14 |
Correct |
8 ms |
1152 KB |
Output is correct |
15 |
Correct |
27 ms |
2424 KB |
Output is correct |
16 |
Correct |
28 ms |
2424 KB |
Output is correct |
17 |
Correct |
21 ms |
2424 KB |
Output is correct |
18 |
Correct |
22 ms |
2304 KB |
Output is correct |
19 |
Incorrect |
29 ms |
2224 KB |
Wrong Answer [2] |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
512 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
3 ms |
512 KB |
Output is correct |
8 |
Correct |
5 ms |
768 KB |
Output is correct |
9 |
Correct |
10 ms |
1152 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
7 ms |
896 KB |
Output is correct |
12 |
Correct |
10 ms |
1152 KB |
Output is correct |
13 |
Correct |
8 ms |
1152 KB |
Output is correct |
14 |
Correct |
8 ms |
1152 KB |
Output is correct |
15 |
Correct |
27 ms |
2424 KB |
Output is correct |
16 |
Correct |
28 ms |
2424 KB |
Output is correct |
17 |
Correct |
21 ms |
2424 KB |
Output is correct |
18 |
Correct |
22 ms |
2304 KB |
Output is correct |
19 |
Incorrect |
29 ms |
2224 KB |
Wrong Answer [2] |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
512 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
3 ms |
512 KB |
Output is correct |
8 |
Correct |
5 ms |
768 KB |
Output is correct |
9 |
Correct |
10 ms |
1152 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
7 ms |
896 KB |
Output is correct |
12 |
Correct |
10 ms |
1152 KB |
Output is correct |
13 |
Correct |
8 ms |
1152 KB |
Output is correct |
14 |
Correct |
8 ms |
1152 KB |
Output is correct |
15 |
Correct |
27 ms |
2424 KB |
Output is correct |
16 |
Correct |
28 ms |
2424 KB |
Output is correct |
17 |
Correct |
21 ms |
2424 KB |
Output is correct |
18 |
Correct |
22 ms |
2304 KB |
Output is correct |
19 |
Incorrect |
29 ms |
2224 KB |
Wrong Answer [2] |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
512 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
3 ms |
512 KB |
Output is correct |
8 |
Correct |
5 ms |
768 KB |
Output is correct |
9 |
Correct |
10 ms |
1152 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
7 ms |
896 KB |
Output is correct |
12 |
Correct |
10 ms |
1152 KB |
Output is correct |
13 |
Correct |
8 ms |
1152 KB |
Output is correct |
14 |
Correct |
8 ms |
1152 KB |
Output is correct |
15 |
Correct |
27 ms |
2424 KB |
Output is correct |
16 |
Correct |
28 ms |
2424 KB |
Output is correct |
17 |
Correct |
21 ms |
2424 KB |
Output is correct |
18 |
Correct |
22 ms |
2304 KB |
Output is correct |
19 |
Incorrect |
29 ms |
2224 KB |
Wrong Answer [2] |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
512 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
3 ms |
512 KB |
Output is correct |
8 |
Correct |
5 ms |
768 KB |
Output is correct |
9 |
Correct |
10 ms |
1152 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
7 ms |
896 KB |
Output is correct |
12 |
Correct |
10 ms |
1152 KB |
Output is correct |
13 |
Correct |
8 ms |
1152 KB |
Output is correct |
14 |
Correct |
8 ms |
1152 KB |
Output is correct |
15 |
Correct |
27 ms |
2424 KB |
Output is correct |
16 |
Correct |
28 ms |
2424 KB |
Output is correct |
17 |
Correct |
21 ms |
2424 KB |
Output is correct |
18 |
Correct |
22 ms |
2304 KB |
Output is correct |
19 |
Incorrect |
29 ms |
2224 KB |
Wrong Answer [2] |
20 |
Halted |
0 ms |
0 KB |
- |