Submission #112733

# Submission time Handle Problem Language Result Execution time Memory
112733 2019-05-21T16:27:07 Z faishol27 Carnival (CEOI14_carnival) C++14
0 / 100
8 ms 256 KB
#include <bits/stdc++.h>
using namespace std;
 
#define pub push_back
 
int n, now, bef = 1;
int ans[155];
int tanya = 0;
vector<int>q;
 
int main(){
 	cin >> n;
 	
 	ans[1] = 1;
 	q.pub(1);
 	for(int i=2;i<=n;i++){
 		cout << q.size()+1;
 		for(int elm:q)
 			cout << " " << elm;
 		cout << " " << i << endl << flush;
 		tanya++;
      
 		cin >> now;
 		if(now != bef){
 			q.pub(i);
 			ans[i] = now;
 		}else{
 			int le = 0,
 				ri = q.size()-1;
 			while(le < ri){
 				int mid = (le+ri)/2;
              	cout << abs(le-mid)+2;
 				for(int j=le;j<=mid;j++)
 					cout << " " << q[j];
 				cout << " " << i << endl << flush;
 				tanya++;
              
 				int resp;
 				cin >> resp;
 				
 				if(resp == abs(le-mid)+1){
 					ri = mid - 1;
 				}else le = mid + 1;
 			}
          
 			int resp;
			cout << "2 " << q[le] << " " << i << endl << flush;
 			tanya++;
	        cin >> resp;
          
          	if(resp == 2) ans[i] = ans[ri];
          	else ans[i] = ans[le];
 		}
 		
 		swap(now, bef);
 	}
 
  	assert(tanya < 950);
  
 	cout << 0;
 	for(int i=1;i<=n;i++)
 		cout << " " << ans[i];
 	cout << endl << flush;
}
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 256 KB Integer 0 violates the range [1, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 256 KB Integer 0 violates the range [1, 5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 256 KB Integer 0 violates the range [1, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 256 KB Integer 0 violates the range [1, 4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 256 KB Integer 0 violates the range [1, 2]
2 Halted 0 ms 0 KB -