답안 #112736

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
112736 2019-05-21T17:07:09 Z faishol27 사육제 (CEOI14_carnival) C++14
100 / 100
10 ms 384 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(ri-le > 1){
 				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;
 				}else le = mid + 1;
 			}
          
 			int resp;
			cout << "2 " << q[le] << " " << i << endl << flush;
 			tanya++;
	        cin >> resp;
			
          	if(resp == 2) ans[i] = ans[q[ri]];
          	else ans[i] = ans[q[le]];
 		}
 		
 		swap(now, bef);
 	}
 
  	assert(tanya < 950);
  
 	cout << 0;
 	for(int i=1;i<=n;i++)
 		cout << " " << ans[i];
 	cout << endl << flush;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 256 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 5 ms 276 KB Output is correct
4 Correct 3 ms 320 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 6 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 6 ms 304 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 7 ms 256 KB Output is correct
7 Correct 9 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 256 KB Output is correct
2 Correct 7 ms 256 KB Output is correct
3 Correct 9 ms 384 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 7 ms 256 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 8 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 8 ms 384 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 10 ms 384 KB Output is correct
6 Correct 7 ms 256 KB Output is correct
7 Correct 7 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 8 ms 384 KB Output is correct
4 Correct 7 ms 256 KB Output is correct
5 Correct 8 ms 256 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 4 ms 384 KB Output is correct