Submission #119005

# Submission time Handle Problem Language Result Execution time Memory
119005 2019-06-20T07:21:59 Z HungAnhGoldIBO2020 Carnival (CEOI14_carnival) C++14
0 / 100
14 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,cut;
	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(ohyeah);
						}
					}
					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(ohyeah);
						}
					}
					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++){
              ~^~~~~~~~~~~~
carnival.cpp:12:34: warning: unused variable 'cut' [-Wunused-variable]
  int n,i,j,k,l,now,now1,ohyeah=0,cut;
                                  ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 256 KB Output is correct
2 Incorrect 10 ms 384 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 6 ms 256 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 256 KB Output is correct
2 Incorrect 8 ms 256 KB Incorrect
3 Halted 0 ms 0 KB -