답안 #113666

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
113666 2019-05-27T15:36:55 Z Adhyyan1252 사육제 (CEOI14_carnival) C++11
0 / 100
6 ms 384 KB
#include<bits/stdc++.h>

using namespace std;

int query(const vector<int>& a){
	if(a.size() == 0) return 0;
	cout<<a.size()<<endl;
	for(int b: a) cout<<b+1<<" ";
	cout<<endl;
	int ret; cin>>ret;
	return ret;
}

int main(){
	int n; cin>>n;
	vector<int> a(n, -1);
	a[0] = 1;
	int pntr = 2;
	vector<int> diff; diff.push_back(0);
	for(int i = 1; i < n; i++){
		int low = 0, high = diff.size()-1, mid;
		vector<int> c(diff); c.push_back(i);
		if(query(c) == c.size()){
			//this is a new one
			a[i]= pntr; pntr++;
			diff.push_back(i);
			continue;
		}
		while(low < high){
			mid = (low + high)/2;
			
			vector<int> b(diff.begin() + low, diff.begin() + mid + 1);
			b.push_back(i);
			int q = query(b);
			if(q == b.size()-1){
				//means that they share the shit
				high = mid;
			}else{
				low = mid+1;
			}
		}
		mid = (low + high)/2;
		a[i] = a[mid];
	}
	cout<<0<<" ";
	for(int i = 0; i < n; i++) cout<<a[i]<<" ";
	cout<<endl;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:23:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(query(c) == c.size()){
      ~~~~~~~~~^~~~~~~~~~~
carnival.cpp:35:9: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if(q == b.size()-1){
       ~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Incorrect 4 ms 384 KB Incorrect
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 252 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 384 KB Output is correct
2 Incorrect 6 ms 256 KB Incorrect
3 Halted 0 ms 0 KB -