#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
void Solve(vector<int> l, vector<int> r, int in)
{
if(l.size()==1)
{
Answer(l[0],r[0]);
return;
}
int pre;
vector<int> L[2],R[2];
int sz=l.size()/2;
if(l.size()==2) sz=1;
for(int i=0;i<l.size();i++) L[i>=sz].pb(l[i]);
for(int i:L[0]) pre=Query(i);
for(int i:r)
{
if(L[0].size()==R[0].size()) R[1].pb(i);
else if(L[1].size()==R[1].size()) R[0].pb(i);
else
{
int now=Query(i);
if(now==pre)
{
if(in) R[1].pb(i);
else R[0].pb(i);
}
else
{
if(in) R[0].pb(i);
else R[1].pb(i);
}
pre=now;
}
}
Solve(L[0],R[0],in^1);
Solve(L[1],R[1],in);
}
void Solve(int n)
{
srand(time(0));
vector<int> l,r;
int pre=0;
for(int i=1;i<=n*2;i++)
{
int now=Query(i);
if(now!=pre) l.pb(i);
else r.pb(i);
pre=now;
}
Solve(l,r,1);
}
Compilation message
minerals.cpp: In function 'void Solve(std::vector<int>, std::vector<int>, int)':
minerals.cpp:16:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
16 | for(int i=0;i<l.size();i++) L[i>=sz].pb(l[i]);
| ~^~~~~~~~~
minerals.cpp:25:8: warning: 'pre' may be used uninitialized in this function [-Wmaybe-uninitialized]
25 | if(now==pre)
| ^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 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 |
344 KB |
Output is correct |
3 |
Correct |
2 ms |
600 KB |
Output is correct |
4 |
Correct |
6 ms |
856 KB |
Output is correct |
5 |
Correct |
9 ms |
1368 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 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 |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
6 ms |
856 KB |
Output is correct |
9 |
Correct |
9 ms |
1368 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
1112 KB |
Output is correct |
12 |
Correct |
11 ms |
1368 KB |
Output is correct |
13 |
Correct |
7 ms |
1368 KB |
Output is correct |
14 |
Correct |
7 ms |
1368 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 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 |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
6 ms |
856 KB |
Output is correct |
9 |
Correct |
9 ms |
1368 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
1112 KB |
Output is correct |
12 |
Correct |
11 ms |
1368 KB |
Output is correct |
13 |
Correct |
7 ms |
1368 KB |
Output is correct |
14 |
Correct |
7 ms |
1368 KB |
Output is correct |
15 |
Correct |
26 ms |
3276 KB |
Output is correct |
16 |
Correct |
26 ms |
3160 KB |
Output is correct |
17 |
Correct |
28 ms |
3028 KB |
Output is correct |
18 |
Correct |
19 ms |
2904 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 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 |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
6 ms |
856 KB |
Output is correct |
9 |
Correct |
9 ms |
1368 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
1112 KB |
Output is correct |
12 |
Correct |
11 ms |
1368 KB |
Output is correct |
13 |
Correct |
7 ms |
1368 KB |
Output is correct |
14 |
Correct |
7 ms |
1368 KB |
Output is correct |
15 |
Correct |
26 ms |
3276 KB |
Output is correct |
16 |
Correct |
26 ms |
3160 KB |
Output is correct |
17 |
Correct |
28 ms |
3028 KB |
Output is correct |
18 |
Correct |
19 ms |
2904 KB |
Output is correct |
19 |
Correct |
30 ms |
3416 KB |
Output is correct |
20 |
Correct |
27 ms |
3416 KB |
Output is correct |
21 |
Correct |
19 ms |
3284 KB |
Output is correct |
22 |
Correct |
20 ms |
3160 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 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 |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
6 ms |
856 KB |
Output is correct |
9 |
Correct |
9 ms |
1368 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
1112 KB |
Output is correct |
12 |
Correct |
11 ms |
1368 KB |
Output is correct |
13 |
Correct |
7 ms |
1368 KB |
Output is correct |
14 |
Correct |
7 ms |
1368 KB |
Output is correct |
15 |
Correct |
26 ms |
3276 KB |
Output is correct |
16 |
Correct |
26 ms |
3160 KB |
Output is correct |
17 |
Correct |
28 ms |
3028 KB |
Output is correct |
18 |
Correct |
19 ms |
2904 KB |
Output is correct |
19 |
Correct |
30 ms |
3416 KB |
Output is correct |
20 |
Correct |
27 ms |
3416 KB |
Output is correct |
21 |
Correct |
19 ms |
3284 KB |
Output is correct |
22 |
Correct |
20 ms |
3160 KB |
Output is correct |
23 |
Correct |
27 ms |
3416 KB |
Output is correct |
24 |
Correct |
29 ms |
3416 KB |
Output is correct |
25 |
Correct |
19 ms |
3284 KB |
Output is correct |
26 |
Correct |
21 ms |
3160 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 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 |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
6 ms |
856 KB |
Output is correct |
9 |
Correct |
9 ms |
1368 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
1112 KB |
Output is correct |
12 |
Correct |
11 ms |
1368 KB |
Output is correct |
13 |
Correct |
7 ms |
1368 KB |
Output is correct |
14 |
Correct |
7 ms |
1368 KB |
Output is correct |
15 |
Correct |
26 ms |
3276 KB |
Output is correct |
16 |
Correct |
26 ms |
3160 KB |
Output is correct |
17 |
Correct |
28 ms |
3028 KB |
Output is correct |
18 |
Correct |
19 ms |
2904 KB |
Output is correct |
19 |
Correct |
30 ms |
3416 KB |
Output is correct |
20 |
Correct |
27 ms |
3416 KB |
Output is correct |
21 |
Correct |
19 ms |
3284 KB |
Output is correct |
22 |
Correct |
20 ms |
3160 KB |
Output is correct |
23 |
Correct |
27 ms |
3416 KB |
Output is correct |
24 |
Correct |
29 ms |
3416 KB |
Output is correct |
25 |
Correct |
19 ms |
3284 KB |
Output is correct |
26 |
Correct |
21 ms |
3160 KB |
Output is correct |
27 |
Correct |
27 ms |
3416 KB |
Output is correct |
28 |
Correct |
28 ms |
3548 KB |
Output is correct |
29 |
Correct |
20 ms |
3284 KB |
Output is correct |
30 |
Correct |
20 ms |
3160 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 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 |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
6 ms |
856 KB |
Output is correct |
9 |
Correct |
9 ms |
1368 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
1112 KB |
Output is correct |
12 |
Correct |
11 ms |
1368 KB |
Output is correct |
13 |
Correct |
7 ms |
1368 KB |
Output is correct |
14 |
Correct |
7 ms |
1368 KB |
Output is correct |
15 |
Correct |
26 ms |
3276 KB |
Output is correct |
16 |
Correct |
26 ms |
3160 KB |
Output is correct |
17 |
Correct |
28 ms |
3028 KB |
Output is correct |
18 |
Correct |
19 ms |
2904 KB |
Output is correct |
19 |
Correct |
30 ms |
3416 KB |
Output is correct |
20 |
Correct |
27 ms |
3416 KB |
Output is correct |
21 |
Correct |
19 ms |
3284 KB |
Output is correct |
22 |
Correct |
20 ms |
3160 KB |
Output is correct |
23 |
Correct |
27 ms |
3416 KB |
Output is correct |
24 |
Correct |
29 ms |
3416 KB |
Output is correct |
25 |
Correct |
19 ms |
3284 KB |
Output is correct |
26 |
Correct |
21 ms |
3160 KB |
Output is correct |
27 |
Correct |
27 ms |
3416 KB |
Output is correct |
28 |
Correct |
28 ms |
3548 KB |
Output is correct |
29 |
Correct |
20 ms |
3284 KB |
Output is correct |
30 |
Correct |
20 ms |
3160 KB |
Output is correct |
31 |
Correct |
30 ms |
3660 KB |
Output is correct |
32 |
Correct |
28 ms |
3416 KB |
Output is correct |
33 |
Correct |
26 ms |
3540 KB |
Output is correct |
34 |
Correct |
20 ms |
3416 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 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 |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
6 ms |
856 KB |
Output is correct |
9 |
Correct |
9 ms |
1368 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
1112 KB |
Output is correct |
12 |
Correct |
11 ms |
1368 KB |
Output is correct |
13 |
Correct |
7 ms |
1368 KB |
Output is correct |
14 |
Correct |
7 ms |
1368 KB |
Output is correct |
15 |
Correct |
26 ms |
3276 KB |
Output is correct |
16 |
Correct |
26 ms |
3160 KB |
Output is correct |
17 |
Correct |
28 ms |
3028 KB |
Output is correct |
18 |
Correct |
19 ms |
2904 KB |
Output is correct |
19 |
Correct |
30 ms |
3416 KB |
Output is correct |
20 |
Correct |
27 ms |
3416 KB |
Output is correct |
21 |
Correct |
19 ms |
3284 KB |
Output is correct |
22 |
Correct |
20 ms |
3160 KB |
Output is correct |
23 |
Correct |
27 ms |
3416 KB |
Output is correct |
24 |
Correct |
29 ms |
3416 KB |
Output is correct |
25 |
Correct |
19 ms |
3284 KB |
Output is correct |
26 |
Correct |
21 ms |
3160 KB |
Output is correct |
27 |
Correct |
27 ms |
3416 KB |
Output is correct |
28 |
Correct |
28 ms |
3548 KB |
Output is correct |
29 |
Correct |
20 ms |
3284 KB |
Output is correct |
30 |
Correct |
20 ms |
3160 KB |
Output is correct |
31 |
Correct |
30 ms |
3660 KB |
Output is correct |
32 |
Correct |
28 ms |
3416 KB |
Output is correct |
33 |
Correct |
26 ms |
3540 KB |
Output is correct |
34 |
Correct |
20 ms |
3416 KB |
Output is correct |
35 |
Incorrect |
28 ms |
3416 KB |
Wrong Answer [2] |
36 |
Halted |
0 ms |
0 KB |
- |