#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <iomanip>
#include <iterator>
#include <limits>
#include <list>
#include <numeric>
#include <random>
#include <ratio>
#include <sstream>
#include <utility>
#include <bitset>
#include <deque>
#include <queue>
#include <map>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <string>
#include <set>
using namespace std;
#define a first
#define b second
#define pb push_back
//typedef long long int;
int n,m;
int it[2001][2001];
int mi=1000000001;
int ma=0;
int ll=0;
int rr=0;
vector<int> ans2[151];
int find(int l,int r,int ind){
if(l==r){
cout<<2<<" "<<ans2[l][0]+1<<" "<<ind+1<<endl;
int x;
cin>>x;
if(x==2){
rr+=1;
return rr;
}
return l;
}
else{
int mid=(l+r)/2;
cout<<mid-l+2<<" ";
for(int j=l;j<mid+1;j++){
cout<<ans2[j][0]+1<<" ";
}
cout<<ind+1<<endl;
int x;
cin>>x;
if(x==mid-l+1){
return find(l,mid,ind);
}
else{
return find(mid+1,r,ind);
}
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin>>n;
int ind=1;
//int ans[n];
ans2[0].pb(0);
for(int i=1;i<n;i++){
int ind5=find(ll,rr,i);
ans2[ind5].pb(i);
}
int ans[n];
for(int i=0;i<rr+1;i++){
for(auto nn:ans2[i]){
ans[nn]=i+1;
}
}
cout<<0<<" ";
for(int i=0;i<n;i++){
cout<<ans[i]<<" ";
}
cout<<endl;
return 0;
}
Compilation message
carnival.cpp: In function 'int main()':
carnival.cpp:84:6: warning: unused variable 'ind' [-Wunused-variable]
int ind=1;
^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
384 KB |
Output is correct |
2 |
Correct |
10 ms |
384 KB |
Output is correct |
3 |
Correct |
12 ms |
384 KB |
Output is correct |
4 |
Correct |
12 ms |
384 KB |
Output is correct |
5 |
Correct |
8 ms |
384 KB |
Output is correct |
6 |
Correct |
7 ms |
408 KB |
Output is correct |
7 |
Correct |
8 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
384 KB |
Output is correct |
2 |
Correct |
13 ms |
384 KB |
Output is correct |
3 |
Correct |
11 ms |
384 KB |
Output is correct |
4 |
Correct |
12 ms |
384 KB |
Output is correct |
5 |
Correct |
9 ms |
384 KB |
Output is correct |
6 |
Correct |
11 ms |
384 KB |
Output is correct |
7 |
Correct |
10 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
384 KB |
Output is correct |
2 |
Correct |
9 ms |
384 KB |
Output is correct |
3 |
Correct |
10 ms |
384 KB |
Output is correct |
4 |
Correct |
13 ms |
384 KB |
Output is correct |
5 |
Correct |
9 ms |
384 KB |
Output is correct |
6 |
Correct |
10 ms |
384 KB |
Output is correct |
7 |
Correct |
10 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
384 KB |
Output is correct |
2 |
Correct |
10 ms |
384 KB |
Output is correct |
3 |
Correct |
15 ms |
384 KB |
Output is correct |
4 |
Correct |
11 ms |
404 KB |
Output is correct |
5 |
Correct |
11 ms |
384 KB |
Output is correct |
6 |
Correct |
10 ms |
384 KB |
Output is correct |
7 |
Correct |
12 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
384 KB |
Output is correct |
2 |
Correct |
10 ms |
384 KB |
Output is correct |
3 |
Correct |
13 ms |
384 KB |
Output is correct |
4 |
Correct |
15 ms |
384 KB |
Output is correct |
5 |
Correct |
12 ms |
384 KB |
Output is correct |
6 |
Correct |
13 ms |
384 KB |
Output is correct |
7 |
Correct |
10 ms |
404 KB |
Output is correct |