#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MAXN=155,MAXA=1e6+5,INF=1e9;
const double EPS=1e-9;
#define fi first
#define se second
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mid (l+r)/2
#define sz(a) int((a).size())
#define all(a) a.begin(),a.end()
#define mod 1000000007LL
#define pb push_back
#define PRINT(x) cerr<<#x<<'-'<<x<<endl<<flush;
#define getunique(v) {sort(all(v)); v.erase(unique(all(v)), v.end());}
#define pb push_back
#define pf push_front
#define ppf pop_front
#define ppb pop_back
#define PRINTvec(x) { cerr<<#x<<"-"; for(int i=0;i<sz(x);i++) cerr<<x[i]<<" "; cerr<<endl; }
ll n,m,k,q,x,y,z,input,l,r;
string s,t;
ifstream in;
vector<int> dif;
vector<int> res;
#ifdef ONLINE_JUDGE
#define in cin
#endif
void nadji_razlicite(){
for(int i=1;i<=n;i++){
cout<<sz(dif)+1<<" "<<i<<" ";
for(auto v:dif) cout<<v<<" ";
cout<<endl;
cin>>input;
if(input>sz(dif)){
res[i]=input;
dif.pb(i);
}
}
}
bool check(int pos,int x){
cout<<pos+2<<" "<<x<<" ";
for(int i=0;i<=pos;i++) cout<<dif[i]<<" ";
cout<<endl;
cin>>input;
return input<pos+2;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>n;
res.resize(n+1);
nadji_razlicite();
for(int i=1;i<=n;i++){
if(res[i]) continue;
l=0; r=sz(dif)-1;
ll ans=0;
while(l<=r){
if(check(mid,i)){
ans=mid;
r=mid-1;
}
else l=mid+1;
}
res[i]=res[dif[ans]];
}
cout<<0<<" ";
for(int i=1;i<=n;i++){
cout<<res[i]<<" ";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
200 KB |
Output is correct |
2 |
Correct |
9 ms |
200 KB |
Output is correct |
3 |
Correct |
6 ms |
200 KB |
Output is correct |
4 |
Correct |
4 ms |
200 KB |
Output is correct |
5 |
Correct |
5 ms |
200 KB |
Output is correct |
6 |
Correct |
4 ms |
200 KB |
Output is correct |
7 |
Correct |
8 ms |
200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
200 KB |
Output is correct |
2 |
Correct |
9 ms |
200 KB |
Output is correct |
3 |
Correct |
5 ms |
200 KB |
Output is correct |
4 |
Correct |
4 ms |
200 KB |
Output is correct |
5 |
Correct |
7 ms |
200 KB |
Output is correct |
6 |
Correct |
8 ms |
200 KB |
Output is correct |
7 |
Correct |
7 ms |
200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
200 KB |
Output is correct |
2 |
Correct |
4 ms |
200 KB |
Output is correct |
3 |
Correct |
10 ms |
200 KB |
Output is correct |
4 |
Correct |
4 ms |
200 KB |
Output is correct |
5 |
Correct |
9 ms |
200 KB |
Output is correct |
6 |
Correct |
9 ms |
200 KB |
Output is correct |
7 |
Correct |
8 ms |
200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
200 KB |
Output is correct |
2 |
Correct |
8 ms |
200 KB |
Output is correct |
3 |
Correct |
6 ms |
200 KB |
Output is correct |
4 |
Correct |
3 ms |
200 KB |
Output is correct |
5 |
Correct |
8 ms |
200 KB |
Output is correct |
6 |
Correct |
8 ms |
200 KB |
Output is correct |
7 |
Correct |
9 ms |
200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
200 KB |
Output is correct |
2 |
Correct |
9 ms |
200 KB |
Output is correct |
3 |
Correct |
8 ms |
200 KB |
Output is correct |
4 |
Correct |
7 ms |
200 KB |
Output is correct |
5 |
Correct |
8 ms |
200 KB |
Output is correct |
6 |
Correct |
6 ms |
200 KB |
Output is correct |
7 |
Correct |
4 ms |
312 KB |
Output is correct |