#include "minerals.h"
#include <vector>
#include <stdio.h>
//using namespace std;
int ans[86005]={0};
bool have[86005];
int cha[86005];
void Solve(int N)
{
int x=0,y,i,j,now=1,tt=0;
for(i=1;i<=2*N;i++)
{
y=Query(i);
tt++;
if(y-x==0)
{
cha[now++]=i;
have[i]=1;
}
x=y;
}
for(i=1;i<=2*N;i++)
{
if(have[i]==0) cha[now++]=i;
/*else
{
Query(i);
tt++;
}*/
}
for(i=0;i<16;i++)
{
for(j=1;j<=N;j++)
{
if(i&&(j&(1<<i))&&((j&(1<<(i-1)))==0)||(i==0&&(j&(1<<i))==0))
{
x=Query(cha[j]);
tt++;
}
}
for(j=1;j<=N;j++)
{
y=Query(cha[j+N]);
tt++;
if(y-x==0) ans[j]+=(1<<i);
x=y;
}
for(j=1;j<=N;j++)
{
if((j&(1<<i))&&(j&(1<<(i+1)))==0&&i!=15)
{
x=Query(cha[j]);
tt++;
}
}
}
//printf("%d\n",tt);
for(i=1;i<=N;i++)
{
Answer(cha[i+N],cha[ans[i]]);
}
}
Compilation message
minerals.cpp: In function 'void Solve(int)':
minerals.cpp:40:20: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
40 | if(i&&(j&(1<<i))&&((j&(1<<(i-1)))==0)||(i==0&&(j&(1<<i))==0))
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
0 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
3 ms |
492 KB |
Output is correct |
4 |
Correct |
5 ms |
620 KB |
Output is correct |
5 |
Correct |
10 ms |
876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
0 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
3 ms |
492 KB |
Output is correct |
8 |
Correct |
5 ms |
620 KB |
Output is correct |
9 |
Correct |
10 ms |
876 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
8 ms |
748 KB |
Output is correct |
12 |
Correct |
10 ms |
1004 KB |
Output is correct |
13 |
Correct |
8 ms |
1024 KB |
Output is correct |
14 |
Correct |
10 ms |
876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
0 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
3 ms |
492 KB |
Output is correct |
8 |
Correct |
5 ms |
620 KB |
Output is correct |
9 |
Correct |
10 ms |
876 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
8 ms |
748 KB |
Output is correct |
12 |
Correct |
10 ms |
1004 KB |
Output is correct |
13 |
Correct |
8 ms |
1024 KB |
Output is correct |
14 |
Correct |
10 ms |
876 KB |
Output is correct |
15 |
Correct |
24 ms |
2028 KB |
Output is correct |
16 |
Correct |
27 ms |
2156 KB |
Output is correct |
17 |
Correct |
23 ms |
2028 KB |
Output is correct |
18 |
Correct |
20 ms |
1900 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
0 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
3 ms |
492 KB |
Output is correct |
8 |
Correct |
5 ms |
620 KB |
Output is correct |
9 |
Correct |
10 ms |
876 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
8 ms |
748 KB |
Output is correct |
12 |
Correct |
10 ms |
1004 KB |
Output is correct |
13 |
Correct |
8 ms |
1024 KB |
Output is correct |
14 |
Correct |
10 ms |
876 KB |
Output is correct |
15 |
Correct |
24 ms |
2028 KB |
Output is correct |
16 |
Correct |
27 ms |
2156 KB |
Output is correct |
17 |
Correct |
23 ms |
2028 KB |
Output is correct |
18 |
Correct |
20 ms |
1900 KB |
Output is correct |
19 |
Incorrect |
25 ms |
1772 KB |
Wrong Answer [2] |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
0 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
3 ms |
492 KB |
Output is correct |
8 |
Correct |
5 ms |
620 KB |
Output is correct |
9 |
Correct |
10 ms |
876 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
8 ms |
748 KB |
Output is correct |
12 |
Correct |
10 ms |
1004 KB |
Output is correct |
13 |
Correct |
8 ms |
1024 KB |
Output is correct |
14 |
Correct |
10 ms |
876 KB |
Output is correct |
15 |
Correct |
24 ms |
2028 KB |
Output is correct |
16 |
Correct |
27 ms |
2156 KB |
Output is correct |
17 |
Correct |
23 ms |
2028 KB |
Output is correct |
18 |
Correct |
20 ms |
1900 KB |
Output is correct |
19 |
Incorrect |
25 ms |
1772 KB |
Wrong Answer [2] |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
0 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
3 ms |
492 KB |
Output is correct |
8 |
Correct |
5 ms |
620 KB |
Output is correct |
9 |
Correct |
10 ms |
876 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
8 ms |
748 KB |
Output is correct |
12 |
Correct |
10 ms |
1004 KB |
Output is correct |
13 |
Correct |
8 ms |
1024 KB |
Output is correct |
14 |
Correct |
10 ms |
876 KB |
Output is correct |
15 |
Correct |
24 ms |
2028 KB |
Output is correct |
16 |
Correct |
27 ms |
2156 KB |
Output is correct |
17 |
Correct |
23 ms |
2028 KB |
Output is correct |
18 |
Correct |
20 ms |
1900 KB |
Output is correct |
19 |
Incorrect |
25 ms |
1772 KB |
Wrong Answer [2] |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
0 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
3 ms |
492 KB |
Output is correct |
8 |
Correct |
5 ms |
620 KB |
Output is correct |
9 |
Correct |
10 ms |
876 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
8 ms |
748 KB |
Output is correct |
12 |
Correct |
10 ms |
1004 KB |
Output is correct |
13 |
Correct |
8 ms |
1024 KB |
Output is correct |
14 |
Correct |
10 ms |
876 KB |
Output is correct |
15 |
Correct |
24 ms |
2028 KB |
Output is correct |
16 |
Correct |
27 ms |
2156 KB |
Output is correct |
17 |
Correct |
23 ms |
2028 KB |
Output is correct |
18 |
Correct |
20 ms |
1900 KB |
Output is correct |
19 |
Incorrect |
25 ms |
1772 KB |
Wrong Answer [2] |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
0 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
3 ms |
492 KB |
Output is correct |
8 |
Correct |
5 ms |
620 KB |
Output is correct |
9 |
Correct |
10 ms |
876 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
8 ms |
748 KB |
Output is correct |
12 |
Correct |
10 ms |
1004 KB |
Output is correct |
13 |
Correct |
8 ms |
1024 KB |
Output is correct |
14 |
Correct |
10 ms |
876 KB |
Output is correct |
15 |
Correct |
24 ms |
2028 KB |
Output is correct |
16 |
Correct |
27 ms |
2156 KB |
Output is correct |
17 |
Correct |
23 ms |
2028 KB |
Output is correct |
18 |
Correct |
20 ms |
1900 KB |
Output is correct |
19 |
Incorrect |
25 ms |
1772 KB |
Wrong Answer [2] |
20 |
Halted |
0 ms |
0 KB |
- |