#include "minerals.h"
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define vii vector < pii >
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class P , class Q > ostream& operator<<(ostream& stream, pair < P , Q > v){ stream << "(" << v.fi << ',' << v.se << ")"; return stream;}
template < class T > ostream& operator<<(ostream& stream, const vector<T> v){ stream << "[ "; for (int i=0; i<(int)v.size(); i++) stream << v[i] << " "; stream << "]"; return stream;}
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
const int N = 1e5 + 5;
int cnt;
void Go(vi a,vi b,int ok) {
random_shuffle(all(b));
if (a.size() == 1) {
Answer(a[0],b[0]);
} else {
int sz = a.size();
int m = sz / 2;
if (ok) {
for (int i = m;i < sz;++i)
cnt = Query(a[i]);
} else {
for (int i = 0;i < m;++i)
cnt = Query(a[i]);
}
vi x,y;
for (auto it : b) {
int cur = Query(it);
if (cnt != cur) {
y.pb(it);
} else {
x.pb(it);
}
cnt = cur;
}
Go(vi(a.begin(),a.begin() + m),x,1);
Go(vi(a.begin() + m,a.end()),y,0);
}
}
void Solve(int N) {
srand(time(0));
vi a,b;
for (int i = 1;i <= 2 * N;++i) {
int cur = Query(i);
if (cnt != cur) {
a.pb(i);
} else {
b.pb(i);
}
cnt = cur;
}
Go(a,b,1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
11 ms |
708 KB |
Output is correct |
5 |
Correct |
18 ms |
1152 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 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 |
11 ms |
708 KB |
Output is correct |
9 |
Correct |
18 ms |
1152 KB |
Output is correct |
10 |
Correct |
3 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
896 KB |
Output is correct |
12 |
Correct |
19 ms |
1280 KB |
Output is correct |
13 |
Correct |
19 ms |
1280 KB |
Output is correct |
14 |
Correct |
18 ms |
1280 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 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 |
11 ms |
708 KB |
Output is correct |
9 |
Correct |
18 ms |
1152 KB |
Output is correct |
10 |
Correct |
3 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
896 KB |
Output is correct |
12 |
Correct |
19 ms |
1280 KB |
Output is correct |
13 |
Correct |
19 ms |
1280 KB |
Output is correct |
14 |
Correct |
18 ms |
1280 KB |
Output is correct |
15 |
Correct |
51 ms |
2804 KB |
Output is correct |
16 |
Correct |
52 ms |
2812 KB |
Output is correct |
17 |
Correct |
49 ms |
2824 KB |
Output is correct |
18 |
Correct |
47 ms |
2580 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 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 |
11 ms |
708 KB |
Output is correct |
9 |
Correct |
18 ms |
1152 KB |
Output is correct |
10 |
Correct |
3 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
896 KB |
Output is correct |
12 |
Correct |
19 ms |
1280 KB |
Output is correct |
13 |
Correct |
19 ms |
1280 KB |
Output is correct |
14 |
Correct |
18 ms |
1280 KB |
Output is correct |
15 |
Correct |
51 ms |
2804 KB |
Output is correct |
16 |
Correct |
52 ms |
2812 KB |
Output is correct |
17 |
Correct |
49 ms |
2824 KB |
Output is correct |
18 |
Correct |
47 ms |
2580 KB |
Output is correct |
19 |
Correct |
52 ms |
2804 KB |
Output is correct |
20 |
Correct |
54 ms |
2856 KB |
Output is correct |
21 |
Correct |
49 ms |
2964 KB |
Output is correct |
22 |
Correct |
49 ms |
2756 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 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 |
11 ms |
708 KB |
Output is correct |
9 |
Correct |
18 ms |
1152 KB |
Output is correct |
10 |
Correct |
3 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
896 KB |
Output is correct |
12 |
Correct |
19 ms |
1280 KB |
Output is correct |
13 |
Correct |
19 ms |
1280 KB |
Output is correct |
14 |
Correct |
18 ms |
1280 KB |
Output is correct |
15 |
Correct |
51 ms |
2804 KB |
Output is correct |
16 |
Correct |
52 ms |
2812 KB |
Output is correct |
17 |
Correct |
49 ms |
2824 KB |
Output is correct |
18 |
Correct |
47 ms |
2580 KB |
Output is correct |
19 |
Correct |
52 ms |
2804 KB |
Output is correct |
20 |
Correct |
54 ms |
2856 KB |
Output is correct |
21 |
Correct |
49 ms |
2964 KB |
Output is correct |
22 |
Correct |
49 ms |
2756 KB |
Output is correct |
23 |
Correct |
53 ms |
2928 KB |
Output is correct |
24 |
Correct |
54 ms |
2944 KB |
Output is correct |
25 |
Correct |
49 ms |
2840 KB |
Output is correct |
26 |
Correct |
50 ms |
2720 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 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 |
11 ms |
708 KB |
Output is correct |
9 |
Correct |
18 ms |
1152 KB |
Output is correct |
10 |
Correct |
3 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
896 KB |
Output is correct |
12 |
Correct |
19 ms |
1280 KB |
Output is correct |
13 |
Correct |
19 ms |
1280 KB |
Output is correct |
14 |
Correct |
18 ms |
1280 KB |
Output is correct |
15 |
Correct |
51 ms |
2804 KB |
Output is correct |
16 |
Correct |
52 ms |
2812 KB |
Output is correct |
17 |
Correct |
49 ms |
2824 KB |
Output is correct |
18 |
Correct |
47 ms |
2580 KB |
Output is correct |
19 |
Correct |
52 ms |
2804 KB |
Output is correct |
20 |
Correct |
54 ms |
2856 KB |
Output is correct |
21 |
Correct |
49 ms |
2964 KB |
Output is correct |
22 |
Correct |
49 ms |
2756 KB |
Output is correct |
23 |
Correct |
53 ms |
2928 KB |
Output is correct |
24 |
Correct |
54 ms |
2944 KB |
Output is correct |
25 |
Correct |
49 ms |
2840 KB |
Output is correct |
26 |
Correct |
50 ms |
2720 KB |
Output is correct |
27 |
Incorrect |
55 ms |
3036 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 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 |
11 ms |
708 KB |
Output is correct |
9 |
Correct |
18 ms |
1152 KB |
Output is correct |
10 |
Correct |
3 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
896 KB |
Output is correct |
12 |
Correct |
19 ms |
1280 KB |
Output is correct |
13 |
Correct |
19 ms |
1280 KB |
Output is correct |
14 |
Correct |
18 ms |
1280 KB |
Output is correct |
15 |
Correct |
51 ms |
2804 KB |
Output is correct |
16 |
Correct |
52 ms |
2812 KB |
Output is correct |
17 |
Correct |
49 ms |
2824 KB |
Output is correct |
18 |
Correct |
47 ms |
2580 KB |
Output is correct |
19 |
Correct |
52 ms |
2804 KB |
Output is correct |
20 |
Correct |
54 ms |
2856 KB |
Output is correct |
21 |
Correct |
49 ms |
2964 KB |
Output is correct |
22 |
Correct |
49 ms |
2756 KB |
Output is correct |
23 |
Correct |
53 ms |
2928 KB |
Output is correct |
24 |
Correct |
54 ms |
2944 KB |
Output is correct |
25 |
Correct |
49 ms |
2840 KB |
Output is correct |
26 |
Correct |
50 ms |
2720 KB |
Output is correct |
27 |
Incorrect |
55 ms |
3036 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 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 |
11 ms |
708 KB |
Output is correct |
9 |
Correct |
18 ms |
1152 KB |
Output is correct |
10 |
Correct |
3 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
896 KB |
Output is correct |
12 |
Correct |
19 ms |
1280 KB |
Output is correct |
13 |
Correct |
19 ms |
1280 KB |
Output is correct |
14 |
Correct |
18 ms |
1280 KB |
Output is correct |
15 |
Correct |
51 ms |
2804 KB |
Output is correct |
16 |
Correct |
52 ms |
2812 KB |
Output is correct |
17 |
Correct |
49 ms |
2824 KB |
Output is correct |
18 |
Correct |
47 ms |
2580 KB |
Output is correct |
19 |
Correct |
52 ms |
2804 KB |
Output is correct |
20 |
Correct |
54 ms |
2856 KB |
Output is correct |
21 |
Correct |
49 ms |
2964 KB |
Output is correct |
22 |
Correct |
49 ms |
2756 KB |
Output is correct |
23 |
Correct |
53 ms |
2928 KB |
Output is correct |
24 |
Correct |
54 ms |
2944 KB |
Output is correct |
25 |
Correct |
49 ms |
2840 KB |
Output is correct |
26 |
Correct |
50 ms |
2720 KB |
Output is correct |
27 |
Incorrect |
55 ms |
3036 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |