#include <bits/stdc++.h>
#include "minerals.h"
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#define fio ios_base::sync_with_stdio(0);cin.tie(0);
#define ll long long
#define en cin.close();return 0;
#define pb push_back
#define fi first//printf("%lli\n",cur);
#define se second//scanf("%lli",&n);
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void go(vector<int> &a, vector<int> &b)
{
assert(a.size()==b.size());
int n = a.size();
if(n==1)
Answer(a[0],b[0]),
Query(a[0]),
Query(b[0]);
else
{
int mid = n/2;
vector<int> la, ra, lb, rb;
for(int i = 0;i<n;i++)
if(i<mid)
la.pb(a[i]);
else
ra.pb(a[i]),
Query(a[i]);
for(int i = 0, lst = n;i<n;i++)
{
int t = Query(b[i]);
if(t==lst)
lb.pb(b[i]),
t = Query(b[i]);
else
rb.pb(b[i]);
lst=t;
}
go(la,lb);
for(auto x:ra)
Query(x);
for(auto x:rb)
Query(x);
go(ra,rb);
}
}
void Solve(int n)
{
vector<int> a, b;
for(int i = 1, lst = 0;i<=2*n;i++)
{
int t = Query(i);
if(t==lst)
b.pb(i);
else
a.pb(i);
lst=t;
}
go(a,b);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
3 ms |
464 KB |
Output is correct |
4 |
Correct |
5 ms |
720 KB |
Output is correct |
5 |
Correct |
10 ms |
1084 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
3 ms |
464 KB |
Output is correct |
8 |
Correct |
5 ms |
720 KB |
Output is correct |
9 |
Correct |
10 ms |
1084 KB |
Output is correct |
10 |
Correct |
1 ms |
316 KB |
Output is correct |
11 |
Correct |
7 ms |
848 KB |
Output is correct |
12 |
Correct |
13 ms |
1296 KB |
Output is correct |
13 |
Correct |
8 ms |
1104 KB |
Output is correct |
14 |
Correct |
10 ms |
1000 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
3 ms |
464 KB |
Output is correct |
8 |
Correct |
5 ms |
720 KB |
Output is correct |
9 |
Correct |
10 ms |
1084 KB |
Output is correct |
10 |
Correct |
1 ms |
316 KB |
Output is correct |
11 |
Correct |
7 ms |
848 KB |
Output is correct |
12 |
Correct |
13 ms |
1296 KB |
Output is correct |
13 |
Correct |
8 ms |
1104 KB |
Output is correct |
14 |
Correct |
10 ms |
1000 KB |
Output is correct |
15 |
Incorrect |
17 ms |
2604 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
3 ms |
464 KB |
Output is correct |
8 |
Correct |
5 ms |
720 KB |
Output is correct |
9 |
Correct |
10 ms |
1084 KB |
Output is correct |
10 |
Correct |
1 ms |
316 KB |
Output is correct |
11 |
Correct |
7 ms |
848 KB |
Output is correct |
12 |
Correct |
13 ms |
1296 KB |
Output is correct |
13 |
Correct |
8 ms |
1104 KB |
Output is correct |
14 |
Correct |
10 ms |
1000 KB |
Output is correct |
15 |
Incorrect |
17 ms |
2604 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
3 ms |
464 KB |
Output is correct |
8 |
Correct |
5 ms |
720 KB |
Output is correct |
9 |
Correct |
10 ms |
1084 KB |
Output is correct |
10 |
Correct |
1 ms |
316 KB |
Output is correct |
11 |
Correct |
7 ms |
848 KB |
Output is correct |
12 |
Correct |
13 ms |
1296 KB |
Output is correct |
13 |
Correct |
8 ms |
1104 KB |
Output is correct |
14 |
Correct |
10 ms |
1000 KB |
Output is correct |
15 |
Incorrect |
17 ms |
2604 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
3 ms |
464 KB |
Output is correct |
8 |
Correct |
5 ms |
720 KB |
Output is correct |
9 |
Correct |
10 ms |
1084 KB |
Output is correct |
10 |
Correct |
1 ms |
316 KB |
Output is correct |
11 |
Correct |
7 ms |
848 KB |
Output is correct |
12 |
Correct |
13 ms |
1296 KB |
Output is correct |
13 |
Correct |
8 ms |
1104 KB |
Output is correct |
14 |
Correct |
10 ms |
1000 KB |
Output is correct |
15 |
Incorrect |
17 ms |
2604 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
3 ms |
464 KB |
Output is correct |
8 |
Correct |
5 ms |
720 KB |
Output is correct |
9 |
Correct |
10 ms |
1084 KB |
Output is correct |
10 |
Correct |
1 ms |
316 KB |
Output is correct |
11 |
Correct |
7 ms |
848 KB |
Output is correct |
12 |
Correct |
13 ms |
1296 KB |
Output is correct |
13 |
Correct |
8 ms |
1104 KB |
Output is correct |
14 |
Correct |
10 ms |
1000 KB |
Output is correct |
15 |
Incorrect |
17 ms |
2604 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
3 ms |
464 KB |
Output is correct |
8 |
Correct |
5 ms |
720 KB |
Output is correct |
9 |
Correct |
10 ms |
1084 KB |
Output is correct |
10 |
Correct |
1 ms |
316 KB |
Output is correct |
11 |
Correct |
7 ms |
848 KB |
Output is correct |
12 |
Correct |
13 ms |
1296 KB |
Output is correct |
13 |
Correct |
8 ms |
1104 KB |
Output is correct |
14 |
Correct |
10 ms |
1000 KB |
Output is correct |
15 |
Incorrect |
17 ms |
2604 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |