답안 #119009

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
119009 2019-06-20T07:31:44 Z HungAnhGoldIBO2020 사육제 (CEOI14_carnival) C++14
100 / 100
22 ms 384 KB
#include<bits/stdc++.h>
#define int long long
using namespace std;
set<int> lis;
set<int> cac1;
vector<int> fuck;
int ans[152];
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	srand(time(0));
	int n,i,j,k,l,now,now1,ohyeah=0;
	cin>>n;
	cout<<n<<" ";
	for(i=1;i<=n;i++){
		cout<<i<<" ";
		lis.insert(i);
	}
	cout<<endl;
	cin>>now;
	while(lis.size()&&now!=1){
		k=0;
		while(k<=1000){
			j=(rand()*rand())%n+1;
			if(lis.count(j)){
				lis.erase(lis.find(j));
				cout<<lis.size()<<" ";
				for(auto ite=lis.begin();ite!=lis.end();ite++){
					cout<<*ite<<" ";
				}
				cout<<endl;
				cin>>now1;
				if(now!=now1){
					ohyeah++;
					ans[j]=ohyeah;
					for(auto ite=cac1.begin();ite!=cac1.end();ite++){
						cout<<"2 "<<j<<" "<<*ite<<endl;
						cin>>l;
						if(l==1){
							ans[*ite]=ohyeah;
							fuck.push_back(*ite);
						}
					}
					for(i=0;i<fuck.size();i++){
						cac1.erase(fuck[i]);
					}
					fuck.clear();
				}
				else{
					cac1.insert(j);
				}
				now=now1;
				break;
			}
			k++;
			if(k==1001){
				auto ite=lis.begin();
				j=*ite;
				lis.erase(lis.find(j));
				cout<<lis.size()<<" ";
				for(auto ite=lis.begin();ite!=lis.end();ite++){
					cout<<*ite<<" ";
				}
				cout<<endl;
				cin>>now1;
				if(now!=now1){
					ohyeah++;
					ans[j]=ohyeah;
					for(auto ite=cac1.begin();ite!=cac1.end();ite++){
						cout<<"2 "<<j<<" "<<*ite<<endl;
						cin>>l;
						if(l==1){
							ans[*ite]=ohyeah;
							fuck.push_back(*ite);
						}
					}
					for(i=0;i<fuck.size();i++){
						cac1.erase(fuck[i]);
					}
					fuck.clear();
				}
				else{
					cac1.insert(j);
				}
				now=now1;
			}
		}
	}
	ohyeah++;
	cout<<"0 ";
	for(i=1;i<=n;i++){
		if(!ans[i]){
			cout<<ohyeah<<" ";
		}
		else{
			cout<<ans[i]<<" ";
		}
	}
	cout<<endl;
	return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:44:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      for(i=0;i<fuck.size();i++){
              ~^~~~~~~~~~~~
carnival.cpp:77:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      for(i=0;i<fuck.size();i++){
              ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 384 KB Output is correct
2 Correct 20 ms 256 KB Output is correct
3 Correct 8 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 12 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 384 KB Output is correct
2 Correct 12 ms 384 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 9 ms 256 KB Output is correct
5 Correct 7 ms 256 KB Output is correct
6 Correct 9 ms 256 KB Output is correct
7 Correct 6 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 13 ms 384 KB Output is correct
4 Correct 7 ms 384 KB Output is correct
5 Correct 13 ms 256 KB Output is correct
6 Correct 14 ms 384 KB Output is correct
7 Correct 9 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 7 ms 384 KB Output is correct
3 Correct 6 ms 256 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 9 ms 256 KB Output is correct
6 Correct 22 ms 384 KB Output is correct
7 Correct 22 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 9 ms 256 KB Output is correct
3 Correct 16 ms 256 KB Output is correct
4 Correct 19 ms 384 KB Output is correct
5 Correct 21 ms 384 KB Output is correct
6 Correct 21 ms 256 KB Output is correct
7 Correct 4 ms 384 KB Output is correct