#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int maxn = 100010;
// map<ll, int> v;
mt19937 mt_rand(time(NULL));
int cval;
void go(vector<int>& a, vector<int>& b, bool aactive, bool bactive) {
// cout << "as: ";
// for (int vv : a) cout << vv << " ";
// cout << endl;
// cout << "bs: ";
// for (int vv : b) cout << vv << " ";
// cout << endl;
vector<int> al, bl, ar, br;
if (a.size() == 1 && b.size() == 1) {
Answer(a[0], b[0]);
return;
}
if (a.size() == 0) return;
int mid = a.size()/2;
//modify what is true for all less than this
for (int i = 0; i < mid; i++) {
cval = Query(a[i]);
al.push_back(a[i]);
}
for (int i = mid; i < a.size(); i++) {
ar.push_back(a[i]);
}
for (int i = 0; i < b.size(); i++) {
// cout << "here: " << b[i] << endl;
int cur = Query(b[i]);
if (cur != cval) {
if (aactive) {
bl.push_back(b[i]);
}
else {
br.push_back(b[i]);
}
}
else {
if (aactive) {
br.push_back(b[i]);
}
else {
bl.push_back(b[i]);
}
}
cval = cur;
}
go(al, bl, !aactive, !bactive);
go(ar, br, aactive, !bactive);
}
void Solve(int N) {
// int nrounds = 1000000/N;
vector<int> cl, cr;
cval = 0;
for (int i = 1; i <= 2*N; i++) {
int cur = Query(i);
if (cur == cval) {
cl.push_back(i);
}
else cr.push_back(i);
cval = cur;
}
go(cl, cr, true, true);
}
Compilation message
minerals.cpp: In function 'void go(std::vector<int>&, std::vector<int>&, bool, bool)':
minerals.cpp:36:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = mid; i < a.size(); i++) {
~~^~~~~~~~~~
minerals.cpp:40:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < b.size(); i++) {
~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
512 KB |
Output is correct |
4 |
Correct |
9 ms |
640 KB |
Output is correct |
5 |
Correct |
15 ms |
1024 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
9 ms |
640 KB |
Output is correct |
9 |
Correct |
15 ms |
1024 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
11 ms |
1024 KB |
Output is correct |
12 |
Correct |
17 ms |
1152 KB |
Output is correct |
13 |
Correct |
14 ms |
1152 KB |
Output is correct |
14 |
Correct |
13 ms |
1024 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
9 ms |
640 KB |
Output is correct |
9 |
Correct |
15 ms |
1024 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
11 ms |
1024 KB |
Output is correct |
12 |
Correct |
17 ms |
1152 KB |
Output is correct |
13 |
Correct |
14 ms |
1152 KB |
Output is correct |
14 |
Correct |
13 ms |
1024 KB |
Output is correct |
15 |
Correct |
43 ms |
2656 KB |
Output is correct |
16 |
Correct |
43 ms |
2532 KB |
Output is correct |
17 |
Correct |
31 ms |
2488 KB |
Output is correct |
18 |
Correct |
34 ms |
2376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
9 ms |
640 KB |
Output is correct |
9 |
Correct |
15 ms |
1024 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
11 ms |
1024 KB |
Output is correct |
12 |
Correct |
17 ms |
1152 KB |
Output is correct |
13 |
Correct |
14 ms |
1152 KB |
Output is correct |
14 |
Correct |
13 ms |
1024 KB |
Output is correct |
15 |
Correct |
43 ms |
2656 KB |
Output is correct |
16 |
Correct |
43 ms |
2532 KB |
Output is correct |
17 |
Correct |
31 ms |
2488 KB |
Output is correct |
18 |
Correct |
34 ms |
2376 KB |
Output is correct |
19 |
Correct |
45 ms |
2688 KB |
Output is correct |
20 |
Correct |
43 ms |
2640 KB |
Output is correct |
21 |
Correct |
32 ms |
2612 KB |
Output is correct |
22 |
Correct |
35 ms |
2372 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
9 ms |
640 KB |
Output is correct |
9 |
Correct |
15 ms |
1024 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
11 ms |
1024 KB |
Output is correct |
12 |
Correct |
17 ms |
1152 KB |
Output is correct |
13 |
Correct |
14 ms |
1152 KB |
Output is correct |
14 |
Correct |
13 ms |
1024 KB |
Output is correct |
15 |
Correct |
43 ms |
2656 KB |
Output is correct |
16 |
Correct |
43 ms |
2532 KB |
Output is correct |
17 |
Correct |
31 ms |
2488 KB |
Output is correct |
18 |
Correct |
34 ms |
2376 KB |
Output is correct |
19 |
Correct |
45 ms |
2688 KB |
Output is correct |
20 |
Correct |
43 ms |
2640 KB |
Output is correct |
21 |
Correct |
32 ms |
2612 KB |
Output is correct |
22 |
Correct |
35 ms |
2372 KB |
Output is correct |
23 |
Correct |
45 ms |
2640 KB |
Output is correct |
24 |
Correct |
45 ms |
2716 KB |
Output is correct |
25 |
Correct |
34 ms |
2592 KB |
Output is correct |
26 |
Correct |
33 ms |
2424 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
9 ms |
640 KB |
Output is correct |
9 |
Correct |
15 ms |
1024 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
11 ms |
1024 KB |
Output is correct |
12 |
Correct |
17 ms |
1152 KB |
Output is correct |
13 |
Correct |
14 ms |
1152 KB |
Output is correct |
14 |
Correct |
13 ms |
1024 KB |
Output is correct |
15 |
Correct |
43 ms |
2656 KB |
Output is correct |
16 |
Correct |
43 ms |
2532 KB |
Output is correct |
17 |
Correct |
31 ms |
2488 KB |
Output is correct |
18 |
Correct |
34 ms |
2376 KB |
Output is correct |
19 |
Correct |
45 ms |
2688 KB |
Output is correct |
20 |
Correct |
43 ms |
2640 KB |
Output is correct |
21 |
Correct |
32 ms |
2612 KB |
Output is correct |
22 |
Correct |
35 ms |
2372 KB |
Output is correct |
23 |
Correct |
45 ms |
2640 KB |
Output is correct |
24 |
Correct |
45 ms |
2716 KB |
Output is correct |
25 |
Correct |
34 ms |
2592 KB |
Output is correct |
26 |
Correct |
33 ms |
2424 KB |
Output is correct |
27 |
Incorrect |
50 ms |
2768 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
9 ms |
640 KB |
Output is correct |
9 |
Correct |
15 ms |
1024 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
11 ms |
1024 KB |
Output is correct |
12 |
Correct |
17 ms |
1152 KB |
Output is correct |
13 |
Correct |
14 ms |
1152 KB |
Output is correct |
14 |
Correct |
13 ms |
1024 KB |
Output is correct |
15 |
Correct |
43 ms |
2656 KB |
Output is correct |
16 |
Correct |
43 ms |
2532 KB |
Output is correct |
17 |
Correct |
31 ms |
2488 KB |
Output is correct |
18 |
Correct |
34 ms |
2376 KB |
Output is correct |
19 |
Correct |
45 ms |
2688 KB |
Output is correct |
20 |
Correct |
43 ms |
2640 KB |
Output is correct |
21 |
Correct |
32 ms |
2612 KB |
Output is correct |
22 |
Correct |
35 ms |
2372 KB |
Output is correct |
23 |
Correct |
45 ms |
2640 KB |
Output is correct |
24 |
Correct |
45 ms |
2716 KB |
Output is correct |
25 |
Correct |
34 ms |
2592 KB |
Output is correct |
26 |
Correct |
33 ms |
2424 KB |
Output is correct |
27 |
Incorrect |
50 ms |
2768 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
9 ms |
640 KB |
Output is correct |
9 |
Correct |
15 ms |
1024 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
11 ms |
1024 KB |
Output is correct |
12 |
Correct |
17 ms |
1152 KB |
Output is correct |
13 |
Correct |
14 ms |
1152 KB |
Output is correct |
14 |
Correct |
13 ms |
1024 KB |
Output is correct |
15 |
Correct |
43 ms |
2656 KB |
Output is correct |
16 |
Correct |
43 ms |
2532 KB |
Output is correct |
17 |
Correct |
31 ms |
2488 KB |
Output is correct |
18 |
Correct |
34 ms |
2376 KB |
Output is correct |
19 |
Correct |
45 ms |
2688 KB |
Output is correct |
20 |
Correct |
43 ms |
2640 KB |
Output is correct |
21 |
Correct |
32 ms |
2612 KB |
Output is correct |
22 |
Correct |
35 ms |
2372 KB |
Output is correct |
23 |
Correct |
45 ms |
2640 KB |
Output is correct |
24 |
Correct |
45 ms |
2716 KB |
Output is correct |
25 |
Correct |
34 ms |
2592 KB |
Output is correct |
26 |
Correct |
33 ms |
2424 KB |
Output is correct |
27 |
Incorrect |
50 ms |
2768 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |