#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ii, int> ri3;
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define SZ(x) (int)(x).size()
#define ALL(x) begin(x), end(x)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define RFOR(i, a, b) for (int i = a; i >= b; --i)
int main() {
//freopen("in.txt", "r", stdin);
ios::sync_with_stdio(false);
cin.tie(0);
int N; cin >> N;
int C[N+1]; memset(C, -1, sizeof C);
vector<int> v;
int t = 1; C[1] = 1; v.push_back(1);
FOR(i,2,N){
cout << SZ(v)+1 << ' ';
for (auto x: v) cout << x << ' ';
cout << i << endl;
int nt; cin >> nt;
if (nt > t) C[i] = SZ(v)+1, v.push_back(i);
t = nt;
}
FOR(i,1,N) if (C[i] == -1) {
int lo = 0, hi = SZ(v);
while (lo < hi) {
int mid = (lo+hi)/2;
cout << mid-lo+2 << ' ';
FOR(j,lo,mid) cout << v[j] << ' ';
cout << i << endl;
int nt; cin >> nt;
if (nt > mid-lo+1) lo = mid+1;
else hi = mid;
}
//cout << "\t\tDEDUCE i " << i << " = " << v[hi] << endl;
C[i] = C[v[hi]];
}
cout << 0;
FOR(i,1,N) cout << ' ' << C[i];
cout << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
248 KB |
Output is correct |
2 |
Correct |
6 ms |
248 KB |
Output is correct |
3 |
Correct |
7 ms |
248 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
6 ms |
248 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
9 ms |
248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
248 KB |
Output is correct |
2 |
Correct |
10 ms |
248 KB |
Output is correct |
3 |
Correct |
4 ms |
248 KB |
Output is correct |
4 |
Correct |
4 ms |
376 KB |
Output is correct |
5 |
Correct |
9 ms |
376 KB |
Output is correct |
6 |
Correct |
8 ms |
380 KB |
Output is correct |
7 |
Correct |
10 ms |
248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
248 KB |
Output is correct |
2 |
Correct |
6 ms |
376 KB |
Output is correct |
3 |
Correct |
10 ms |
376 KB |
Output is correct |
4 |
Correct |
4 ms |
328 KB |
Output is correct |
5 |
Correct |
10 ms |
248 KB |
Output is correct |
6 |
Correct |
10 ms |
248 KB |
Output is correct |
7 |
Correct |
11 ms |
248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
420 KB |
Output is correct |
2 |
Correct |
7 ms |
248 KB |
Output is correct |
3 |
Correct |
7 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
296 KB |
Output is correct |
5 |
Correct |
12 ms |
248 KB |
Output is correct |
6 |
Correct |
6 ms |
248 KB |
Output is correct |
7 |
Correct |
11 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
376 KB |
Output is correct |
2 |
Correct |
10 ms |
380 KB |
Output is correct |
3 |
Correct |
10 ms |
376 KB |
Output is correct |
4 |
Correct |
8 ms |
248 KB |
Output is correct |
5 |
Correct |
9 ms |
248 KB |
Output is correct |
6 |
Correct |
7 ms |
248 KB |
Output is correct |
7 |
Correct |
6 ms |
376 KB |
Output is correct |