// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
// Nhan qua khong no chung ta thu gi //
// Vay nen dung oan han //
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
// //
// _oo0oo_ //
// o8888888o //
// 88" . "88 //
// (| -_- |) //
// 0\ = /0 //
// ___/`---'\___ //
// .' \\| |// '. //
// / \\||| : |||// \ //
// / _||||| -:- |||||- \ //
// | | \\\ - /// | | //
// | \_| ''\---/'' |_/ | //
// \ .-\__ '-' ___/-. / //
// ___'. .' /--.--\ `. .'___ //
// ."" '< `.___\_<|>_/___.' >' "". //
// | | : `- \`.;`\ _ /`;.`/ - ` : | | //
// \ \ `_. \_ __\ /__ _/ .-` / / //
// =====`-.____`.___ \_____/___.-`___.-'===== //
// `=---=' //
// //
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
// Duc Phat noi day phu ho Code con chay khong Bug //
// Nam mo a di da phat //
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
#include<bits/stdc++.h>
#ifdef LOCAL
#include "D:\debug.h"
#else
#define cebug(...) "Orz_chUoNgnn"
#endif
using namespace std;
#define fi first
#define se second
#define pb push_back
#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
#define cd complex<double>
const ll mod = 1e9 + 7;
const ll INF = 1e18L + 5;
const double PI = acos(-1);
const int block = 14;
const int N = 200;
int tc, tt = 1;
int n;
int a[N + 5];
map<ii, int> mp;
vi f;
int query(int l, int r) {
if(r < l) return 0;
if(mp.count({l, r})) return mp[{l, r}];
f.clear();
for(int i=l; i<=r; i++) f.pb(i);
cout<<f.size()<<' ';
for(auto x: f) cout<<x<<' ';
cout<<'\n'<<flush;
int res;
cin>>res;
mp[{l, r}] = res;
return res;
}
void solve() {
cin>>n;
int cur = 0;
for(int i=1; i<=n; i++) if(!a[i]) {
cur++;
a[i] = cur;
int it = i;
while(true) {
int l = it + 1, r = n;
int res = it;
while(l <= r) {
int mid = (l + r)/2;
if(query(it, mid) != query(it + 1, mid)) l = mid + 1;
else {
if(query(it + 1, mid) != query(it + 1, mid - 1)) res = mid;
r = mid - 1;
}
}
a[res] = cur;
if(it == res) break;
it = res;
}
}
cout<<0<<' ';
for(int i=1; i<=n; i++) cout<<a[i]<<' ';
cout<<'\n'<<flush;
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
// freopen(".INP", "r", stdin);
// freopen(".OUT", "w", stdout);
for(int tc=1; tc<=tt; tc++) solve();
cerr<<"\nTime elapsed: "<<1000.0*clock()/CLOCKS_PER_SEC<<" ms.\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
344 KB |
Output is correct |
2 |
Correct |
10 ms |
344 KB |
Output is correct |
3 |
Correct |
10 ms |
600 KB |
Output is correct |
4 |
Correct |
10 ms |
600 KB |
Output is correct |
5 |
Correct |
10 ms |
460 KB |
Output is correct |
6 |
Correct |
9 ms |
344 KB |
Output is correct |
7 |
Correct |
12 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
344 KB |
Output is correct |
2 |
Correct |
12 ms |
648 KB |
Output is correct |
3 |
Correct |
7 ms |
344 KB |
Output is correct |
4 |
Correct |
11 ms |
716 KB |
Output is correct |
5 |
Correct |
11 ms |
600 KB |
Output is correct |
6 |
Correct |
12 ms |
344 KB |
Output is correct |
7 |
Correct |
14 ms |
1120 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
344 KB |
Output is correct |
2 |
Correct |
13 ms |
748 KB |
Output is correct |
3 |
Correct |
11 ms |
460 KB |
Output is correct |
4 |
Correct |
9 ms |
464 KB |
Output is correct |
5 |
Correct |
10 ms |
544 KB |
Output is correct |
6 |
Correct |
11 ms |
344 KB |
Output is correct |
7 |
Correct |
12 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
476 KB |
Output is correct |
2 |
Correct |
10 ms |
344 KB |
Output is correct |
3 |
Correct |
13 ms |
600 KB |
Output is correct |
4 |
Correct |
9 ms |
344 KB |
Output is correct |
5 |
Correct |
18 ms |
716 KB |
Output is correct |
6 |
Correct |
18 ms |
484 KB |
Output is correct |
7 |
Correct |
11 ms |
536 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
600 KB |
Output is correct |
2 |
Correct |
12 ms |
500 KB |
Output is correct |
3 |
Correct |
20 ms |
712 KB |
Output is correct |
4 |
Correct |
15 ms |
488 KB |
Output is correct |
5 |
Correct |
12 ms |
520 KB |
Output is correct |
6 |
Correct |
12 ms |
508 KB |
Output is correct |
7 |
Correct |
14 ms |
628 KB |
Output is correct |