#include<iostream>
#include <bits/stdc++.h>
#include "minerals.h"
#define ll long long
#define ld long double
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
void solve(vector<int> & v1, vector<int> & v2, bool p)
{
int n=v1.size();
if(n==1)
{
Answer(v1.back(),v2.back());
return ;
}
if(!n)
return;
vector<int> x1, y1, x2, y2;
int x;
for(int i=0; i<n; i++)
{
if(i<=n*0.4)
{
x=Query(v1[i]);
x1.push_back(v1[i]);
}
else
x2.push_back(v1[i]);
}
for(auto i : v2)
{
int q=Query(i);
if((q!=x && p) || (q==x && !p))
y1.push_back(i);
else
y2.push_back(i);
x=q;
}
v1.clear(), v2.clear();
solve(x1,y1,!p);
solve(x2,y2,p);
}
void Solve(int N)
{
vector<int> v1, v2;
int last=0;
for (int i = 1; i <= 2 * N; ++i)
{
int x=Query(i);
if(x!=last)
v1.push_back(i);
else
v2.push_back(i);
last=x;
}
solve(v1,v2, 1);
}
Compilation message
minerals.cpp: In function 'void solve(std::vector<int>&, std::vector<int>&, bool)':
minerals.cpp:33:14: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
if((q!=x && p) || (q==x && !p))
~^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
512 KB |
Output is correct |
3 |
Correct |
5 ms |
620 KB |
Output is correct |
4 |
Correct |
10 ms |
768 KB |
Output is correct |
5 |
Correct |
18 ms |
1280 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 |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
512 KB |
Output is correct |
7 |
Correct |
5 ms |
620 KB |
Output is correct |
8 |
Correct |
10 ms |
768 KB |
Output is correct |
9 |
Correct |
18 ms |
1280 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
1024 KB |
Output is correct |
12 |
Correct |
18 ms |
1280 KB |
Output is correct |
13 |
Correct |
16 ms |
1280 KB |
Output is correct |
14 |
Correct |
16 ms |
1264 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 |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
512 KB |
Output is correct |
7 |
Correct |
5 ms |
620 KB |
Output is correct |
8 |
Correct |
10 ms |
768 KB |
Output is correct |
9 |
Correct |
18 ms |
1280 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
1024 KB |
Output is correct |
12 |
Correct |
18 ms |
1280 KB |
Output is correct |
13 |
Correct |
16 ms |
1280 KB |
Output is correct |
14 |
Correct |
16 ms |
1264 KB |
Output is correct |
15 |
Correct |
47 ms |
2748 KB |
Output is correct |
16 |
Correct |
48 ms |
2776 KB |
Output is correct |
17 |
Correct |
45 ms |
2756 KB |
Output is correct |
18 |
Correct |
43 ms |
2652 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 |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
512 KB |
Output is correct |
7 |
Correct |
5 ms |
620 KB |
Output is correct |
8 |
Correct |
10 ms |
768 KB |
Output is correct |
9 |
Correct |
18 ms |
1280 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
1024 KB |
Output is correct |
12 |
Correct |
18 ms |
1280 KB |
Output is correct |
13 |
Correct |
16 ms |
1280 KB |
Output is correct |
14 |
Correct |
16 ms |
1264 KB |
Output is correct |
15 |
Correct |
47 ms |
2748 KB |
Output is correct |
16 |
Correct |
48 ms |
2776 KB |
Output is correct |
17 |
Correct |
45 ms |
2756 KB |
Output is correct |
18 |
Correct |
43 ms |
2652 KB |
Output is correct |
19 |
Correct |
52 ms |
2872 KB |
Output is correct |
20 |
Correct |
51 ms |
2868 KB |
Output is correct |
21 |
Correct |
43 ms |
2876 KB |
Output is correct |
22 |
Correct |
44 ms |
2648 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 |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
512 KB |
Output is correct |
7 |
Correct |
5 ms |
620 KB |
Output is correct |
8 |
Correct |
10 ms |
768 KB |
Output is correct |
9 |
Correct |
18 ms |
1280 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
1024 KB |
Output is correct |
12 |
Correct |
18 ms |
1280 KB |
Output is correct |
13 |
Correct |
16 ms |
1280 KB |
Output is correct |
14 |
Correct |
16 ms |
1264 KB |
Output is correct |
15 |
Correct |
47 ms |
2748 KB |
Output is correct |
16 |
Correct |
48 ms |
2776 KB |
Output is correct |
17 |
Correct |
45 ms |
2756 KB |
Output is correct |
18 |
Correct |
43 ms |
2652 KB |
Output is correct |
19 |
Correct |
52 ms |
2872 KB |
Output is correct |
20 |
Correct |
51 ms |
2868 KB |
Output is correct |
21 |
Correct |
43 ms |
2876 KB |
Output is correct |
22 |
Correct |
44 ms |
2648 KB |
Output is correct |
23 |
Correct |
52 ms |
2884 KB |
Output is correct |
24 |
Correct |
53 ms |
2860 KB |
Output is correct |
25 |
Correct |
44 ms |
2884 KB |
Output is correct |
26 |
Correct |
42 ms |
2760 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 |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
512 KB |
Output is correct |
7 |
Correct |
5 ms |
620 KB |
Output is correct |
8 |
Correct |
10 ms |
768 KB |
Output is correct |
9 |
Correct |
18 ms |
1280 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
1024 KB |
Output is correct |
12 |
Correct |
18 ms |
1280 KB |
Output is correct |
13 |
Correct |
16 ms |
1280 KB |
Output is correct |
14 |
Correct |
16 ms |
1264 KB |
Output is correct |
15 |
Correct |
47 ms |
2748 KB |
Output is correct |
16 |
Correct |
48 ms |
2776 KB |
Output is correct |
17 |
Correct |
45 ms |
2756 KB |
Output is correct |
18 |
Correct |
43 ms |
2652 KB |
Output is correct |
19 |
Correct |
52 ms |
2872 KB |
Output is correct |
20 |
Correct |
51 ms |
2868 KB |
Output is correct |
21 |
Correct |
43 ms |
2876 KB |
Output is correct |
22 |
Correct |
44 ms |
2648 KB |
Output is correct |
23 |
Correct |
52 ms |
2884 KB |
Output is correct |
24 |
Correct |
53 ms |
2860 KB |
Output is correct |
25 |
Correct |
44 ms |
2884 KB |
Output is correct |
26 |
Correct |
42 ms |
2760 KB |
Output is correct |
27 |
Incorrect |
53 ms |
2976 KB |
Wrong Answer [2] |
28 |
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 |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
512 KB |
Output is correct |
7 |
Correct |
5 ms |
620 KB |
Output is correct |
8 |
Correct |
10 ms |
768 KB |
Output is correct |
9 |
Correct |
18 ms |
1280 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
1024 KB |
Output is correct |
12 |
Correct |
18 ms |
1280 KB |
Output is correct |
13 |
Correct |
16 ms |
1280 KB |
Output is correct |
14 |
Correct |
16 ms |
1264 KB |
Output is correct |
15 |
Correct |
47 ms |
2748 KB |
Output is correct |
16 |
Correct |
48 ms |
2776 KB |
Output is correct |
17 |
Correct |
45 ms |
2756 KB |
Output is correct |
18 |
Correct |
43 ms |
2652 KB |
Output is correct |
19 |
Correct |
52 ms |
2872 KB |
Output is correct |
20 |
Correct |
51 ms |
2868 KB |
Output is correct |
21 |
Correct |
43 ms |
2876 KB |
Output is correct |
22 |
Correct |
44 ms |
2648 KB |
Output is correct |
23 |
Correct |
52 ms |
2884 KB |
Output is correct |
24 |
Correct |
53 ms |
2860 KB |
Output is correct |
25 |
Correct |
44 ms |
2884 KB |
Output is correct |
26 |
Correct |
42 ms |
2760 KB |
Output is correct |
27 |
Incorrect |
53 ms |
2976 KB |
Wrong Answer [2] |
28 |
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 |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
512 KB |
Output is correct |
7 |
Correct |
5 ms |
620 KB |
Output is correct |
8 |
Correct |
10 ms |
768 KB |
Output is correct |
9 |
Correct |
18 ms |
1280 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
1024 KB |
Output is correct |
12 |
Correct |
18 ms |
1280 KB |
Output is correct |
13 |
Correct |
16 ms |
1280 KB |
Output is correct |
14 |
Correct |
16 ms |
1264 KB |
Output is correct |
15 |
Correct |
47 ms |
2748 KB |
Output is correct |
16 |
Correct |
48 ms |
2776 KB |
Output is correct |
17 |
Correct |
45 ms |
2756 KB |
Output is correct |
18 |
Correct |
43 ms |
2652 KB |
Output is correct |
19 |
Correct |
52 ms |
2872 KB |
Output is correct |
20 |
Correct |
51 ms |
2868 KB |
Output is correct |
21 |
Correct |
43 ms |
2876 KB |
Output is correct |
22 |
Correct |
44 ms |
2648 KB |
Output is correct |
23 |
Correct |
52 ms |
2884 KB |
Output is correct |
24 |
Correct |
53 ms |
2860 KB |
Output is correct |
25 |
Correct |
44 ms |
2884 KB |
Output is correct |
26 |
Correct |
42 ms |
2760 KB |
Output is correct |
27 |
Incorrect |
53 ms |
2976 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |