#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
const int N = 3e5 + 5;
const int mod = 1e9 + 7, oo = 1e18 + 7;
int n;
int cnt;
vector<int> comps[N];
int cal(vector<int> vc){
cout << vc.size() << " ";
for(auto it : vc) cout << it << " ";
cout << "\n";
int x;
cin >> x;
return x;
}
int answer[N];
void process(){
cin >> n;
comps[1].pb(1);
cnt = 1;
for(int i = 2; i <= n; i++){
vector<int> ask;
for(int j = 1; j <= i; j++) ask.pb(j);
if(cal(ask) > cnt){
cnt++;
comps[cnt].pb(i);
continue;
}
int l = 1, r = cnt;// first component that contains this guy
while(l < r){
int mid = (l + r) >> 1;
ask.clear();
for(int j = 1; j <= mid; j++){
for(auto it : comps[j]) ask.pb(it);
}
ask.pb(i);
if(cal(ask) > mid) l = mid + 1;
else r = mid;
}
comps[l].pb(i);
}
for(int i = 1; i <= cnt; i++){
for(auto it : comps[i]) answer[it] = i;
}
cout << 0 << " ";
for(int i = 1; i <= n; i++) cout << answer[i] << " ";
cout << "\n";
}
signed main(){
//ios_base::sync_with_stdio(0);
//freopen("KEK.inp", "r", stdin);
//freopen("KEK.out", "w", stdout);
//cin.tie(0);
process();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
7376 KB |
Output is correct |
2 |
Correct |
14 ms |
7360 KB |
Output is correct |
3 |
Correct |
10 ms |
7364 KB |
Output is correct |
4 |
Correct |
6 ms |
7376 KB |
Output is correct |
5 |
Correct |
10 ms |
7376 KB |
Output is correct |
6 |
Correct |
8 ms |
7376 KB |
Output is correct |
7 |
Correct |
11 ms |
7492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
7372 KB |
Output is correct |
2 |
Correct |
12 ms |
7376 KB |
Output is correct |
3 |
Correct |
8 ms |
7380 KB |
Output is correct |
4 |
Correct |
6 ms |
7352 KB |
Output is correct |
5 |
Correct |
13 ms |
7388 KB |
Output is correct |
6 |
Correct |
12 ms |
7368 KB |
Output is correct |
7 |
Correct |
13 ms |
7364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
7380 KB |
Output is correct |
2 |
Correct |
12 ms |
7364 KB |
Output is correct |
3 |
Correct |
14 ms |
7364 KB |
Output is correct |
4 |
Correct |
6 ms |
7388 KB |
Output is correct |
5 |
Correct |
14 ms |
7356 KB |
Output is correct |
6 |
Correct |
12 ms |
7376 KB |
Output is correct |
7 |
Correct |
13 ms |
7380 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
7352 KB |
Output is correct |
2 |
Correct |
10 ms |
7256 KB |
Output is correct |
3 |
Correct |
8 ms |
7376 KB |
Output is correct |
4 |
Correct |
5 ms |
7356 KB |
Output is correct |
5 |
Correct |
13 ms |
7380 KB |
Output is correct |
6 |
Correct |
10 ms |
7388 KB |
Output is correct |
7 |
Correct |
14 ms |
7360 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
7376 KB |
Output is correct |
2 |
Correct |
12 ms |
7364 KB |
Output is correct |
3 |
Correct |
11 ms |
7352 KB |
Output is correct |
4 |
Correct |
11 ms |
7376 KB |
Output is correct |
5 |
Correct |
11 ms |
7372 KB |
Output is correct |
6 |
Correct |
8 ms |
7376 KB |
Output is correct |
7 |
Correct |
7 ms |
7376 KB |
Output is correct |