Submission #1132557

#TimeUsernameProblemLanguageResultExecution timeMemory
1132557lopkusCarnival (CEOI14_carnival)C++20
20 / 100
25 ms432 KiB
#include <bits/stdc++.h> #define int long long using namespace std; int ask(int k, vector<int> V) { cout << k << " "; for(auto it : V) { cout << it << " "; } cout << endl; int x; cin >> x; return x; } void answer(vector<int> ans) { cout << "0 "; for(auto it : ans) { cout << it << " "; } } signed main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> ans(n + 1, 0); int current = 1; for(int i = 1; i <= n; i++) { if(ans[i] == 0) { ans[i] = current++; for(int j = i + 1; j <= n; j++) { if(ask(2, {i, j}) == 1) { ans[j] = ans[i]; } } } } cout << "0 "; for(int i = 1; i <= n; i++) { cout << ans[i] << " "; } }
#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...