Submission #441033

#TimeUsernameProblemLanguageResultExecution timeMemory
441033robellCarnival (CEOI14_carnival)C++14
0 / 100
117 ms312 KiB
#include <bits/stdc++.h> using namespace std; vector<int> n; vector<int> v; vector<vector<int> > l; void dfs(int i, int count){ v[i]=count; for (int j:l[i]){ if (v[j]<0){ dfs(j,count); } } } int main(){ int N; cin >> N; for (int i=1;i<=N;i++){ n.push_back(-1); l.push_back(vector<int>()); v.push_back(-1); } for (int i=0;i<N;i++){ for (int j=i+1;j<N;j++){ cout << 2 << " "<< i+1 << " " << j+1 << endl; int store; cin >> store; if (store==1) l[i].push_back(j); } } int count = 1; for (int i=0;i<N;i++){ if (v[i]<0){ dfs(i,count); count++; } } for (int i=0;i<N;i++){ cout << v[i] << " "; } cout << endl; 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...