Submission #467943

#TimeUsernameProblemLanguageResultExecution timeMemory
467943Urvuk3Carnival (CEOI14_carnival)C++17
0 / 100
17 ms200 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int MAXN=155,MAXA=1e6+5,INF=1e9; const double EPS=1e-9; #define fi first #define se second #define pll pair<ll,ll> #define pii pair<int,int> #define mid (l+r)/2 #define sz(a) int((a).size()) #define all(a) a.begin(),a.end() #define mod 1000000007LL #define pb push_back #define PRINT(x) cerr<<#x<<'-'<<x<<endl<<flush; #define getunique(v) {sort(all(v)); v.erase(unique(all(v)), v.end());} #define pb push_back #define pf push_front #define ppf pop_front #define ppb pop_back #define PRINTvec(x) { cerr<<#x<<"-"; for(int i=0;i<sz(x);i++) cerr<<x[i]<<" "; cerr<<endl; } ll n,m,k,q,x,y,z,ret; string s,t; ifstream in; #ifdef ONLINE_JUDGE #define in cin #endif int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>n; vector<int> dsu(n+1,0); iota(all(dsu),0); set<int> roots; for(int i=1;i<=n;i++){ if(dsu[i]!=i) continue; //nije trenutni root roots.clear(); for(int j=1;j<=n;j++){ if(dsu[j]!=i) roots.insert(dsu[j]); } cout<<sz(roots)+1<<" "<<i<<" "; for(auto v:roots){ cout<<v<<" "; } cout<<endl; cin>>ret; if(ret==sz(roots)+1){ continue; } for(auto v:roots){ cout<<2<<" "<<i<<" "<<v<<endl; cin>>ret; if(ret==1){ dsu[i]=v; break; } } } cout<<0<<" "; for(int i=1;i<=n;i++){ cout<<dsu[i]<<" "; } return 0; }
#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...