Submission #112723

# Submission time Handle Problem Language Result Execution time Memory
112723 2019-05-21T15:56:29 Z faishol27 Carnival (CEOI14_carnival) C++14
20 / 100
11 ms 512 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 akar = sqrt(q.size())+1,
 				frn = -1,
 				sz = q.size();
 				
 			int le = 0,
 				ri = min(le+akar-1, sz-1);
 			while(frn == -1){
 				cout << abs(le-ri)+2;
 				for(int j=le;j<=ri;j++)
 					cout << " " << q[j];
 				cout << " " << i << endl << flush;
 				tanya++;
              
 				int resp;
 				cin >> resp;
 				
 				if(resp == abs(le-ri)+1){
 					for(int j=le;j<=ri && frn == -1;j++){
 						cout << "2 " << q[j] << " " << i << endl << flush;
 						tanya++;
                      
                	    int tmp;
 						cin >> tmp;
 						if(tmp == 1) frn = q[j];
 					}
 				}
 				
 				le = ri+1;
 				ri = min(le+akar-1, sz-1);
 			}
 			
 			ans[i] = ans[frn];
 		}
 		
 		swap(now, bef);
 	}
 
  	assert(tanya < 750);
  
 	cout << 0;
 	for(int i=1;i<=n;i++)
 		cout << " " << ans[i];
 	cout << endl << flush;
}
# Verdict Execution time Memory Grader output
1 Correct 8 ms 256 KB Output is correct
2 Correct 9 ms 256 KB Output is correct
3 Correct 7 ms 384 KB Output is correct
4 Correct 3 ms 324 KB Output is correct
5 Correct 7 ms 384 KB Output is correct
6 Correct 6 ms 256 KB Output is correct
7 Correct 8 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 256 KB Output is correct
2 Runtime error 11 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Runtime error 9 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 256 KB Output is correct
2 Correct 7 ms 256 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 6 ms 512 KB Output is correct
6 Correct 6 ms 256 KB Output is correct
7 Runtime error 9 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Runtime error 10 ms 424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -