답안 #164479

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
164479 2019-11-21T03:19:50 Z oolimry 사육제 (CEOI14_carnival) C++14
100 / 100
20 ms 376 KB
#include <bits/stdc++.h>

using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> unique;
	int answer[n+1];
	for(int i = 1;i <= n;i++){
		cout << unique.size() + 1 << " ";
		for(int x : unique) cout << x << " ";
		cout << i << " ";
		cout << endl;
		
		int no;
		cin >> no;
		if(no == unique.size()){
			int low = -1;
			int high = unique.size();
			while(true){
				if(low == high - 1) break;
				int s = (low + high) / 2;
				cout << s + 2 << " ";
				for(int j = 0;j <= s;j++){
					cout << unique[j] << " ";
				}
				cout << i << " ";
				cout << endl;
				
				int no;
				cin >> no;
				if(no == s + 1){
					high = s; ///overlap
				}
				else{
					low = s; ///i is diff from 0...s
				}
			}
			answer[i] = high;
		}
		else{
			answer[i] = unique.size();
			unique.push_back(i);
		}
	}
	cout << "0 ";
	for(int i = 1;i <= n;i++){
		cout << answer[i] + 1 << " ";
	}
	return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:18:9: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(no == unique.size()){
      ~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 248 KB Output is correct
2 Correct 11 ms 248 KB Output is correct
3 Correct 7 ms 252 KB Output is correct
4 Correct 4 ms 312 KB Output is correct
5 Correct 4 ms 252 KB Output is correct
6 Correct 3 ms 248 KB Output is correct
7 Correct 6 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 248 KB Output is correct
2 Correct 12 ms 248 KB Output is correct
3 Correct 7 ms 248 KB Output is correct
4 Correct 6 ms 376 KB Output is correct
5 Correct 9 ms 248 KB Output is correct
6 Correct 4 ms 248 KB Output is correct
7 Correct 8 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 9 ms 248 KB Output is correct
3 Correct 11 ms 376 KB Output is correct
4 Correct 4 ms 316 KB Output is correct
5 Correct 7 ms 376 KB Output is correct
6 Correct 8 ms 376 KB Output is correct
7 Correct 7 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 248 KB Output is correct
2 Correct 6 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 7 ms 248 KB Output is correct
5 Correct 8 ms 376 KB Output is correct
6 Correct 7 ms 376 KB Output is correct
7 Correct 11 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 376 KB Output is correct
2 Correct 6 ms 296 KB Output is correct
3 Correct 10 ms 248 KB Output is correct
4 Correct 9 ms 376 KB Output is correct
5 Correct 20 ms 248 KB Output is correct
6 Correct 7 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct