Submission #770494

#TimeUsernameProblemLanguageResultExecution timeMemory
770494Ahmed57Carnival (CEOI14_carnival)C++17
0 / 100
1 ms316 KiB
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; //DSU int mn = 10001; int pr[151]; int findleader(int x){ if(pr[x]==x){ return x; } return pr[x] = findleader(pr[x]); } bool samegroup(int x,int y){ int led1 = findleader(x); int led2 = findleader(y); return led1==led2; } void mergegroup(int x,int y){ int led1 = findleader(x); int led2 = findleader(y); if(led1==led2)return; pr[led2] = led1; } int query(vector<int> x){ cout<<x.size()<<" "; for(auto i:x){ cout<<i+1<<" "; } cout<<endl; int lol;cin>>lol;return lol; } int main(){ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); int n; cin>>n; for(int i = 0;i<n;i++)pr[i] = i; int b = 13; int vis[n] = {0}; for(int i = 0;i<n;i++){ if(vis[findleader(i)])continue; for(int j = i-(i%b);j<n;j++){ if(j%b==0){ vector<int> lol = {i}; for(int e = j;e<min(n,j+b);e++){ if(e!=i){ lol.push_back(e);cout<<e<<endl; } } if(query(lol)==lol.size())continue; for(int e = j;e<min(n,j+b);e++){ if(e!=i){ if(query({i,e})==1){ mergegroup(i,e); } } } } } vis[i] = 1; } int vis2[n] = {0}; int z = 0; cout<<"0 "; for(int i = 0;i<n;i++){ if(!vis2[findleader(i)]){ vis2[findleader(i)] = ++z; } cout<<vis2[findleader(i)]<<" "; } return 0; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:51:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |                 if(query(lol)==lol.size())continue;
      |                    ~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...