Submission #908642

#TimeUsernameProblemLanguageResultExecution timeMemory
908642vjudge1Carnival (CEOI14_carnival)C++17
20 / 100
67 ms756 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 150 + 7; bool found[N], root[N]; vector<int> same[N]; int sol[N]; int n; int ask(vector<int> guys) { cout << guys.size() << " "; for (int i : guys) cout << i << " "; cout << endl; int res; cin >> res; return res; } int main() { cin >> n; for (int i = 1; i <= n; ++i) { for (int j = i + 1; j <= n; ++j) { if (found[j] == true) continue; vector<int> v = {i, j}; if (ask(v) == 1) { same[i].push_back(j); root[i] = true; found[j] = true; } } } for (int i = 1; i <= n; ++i) if (found[i] == 0) root[i] = 1; int c = 0; for (int i = 1; i <= n; ++i) { if (root[i] == 1) { ++c; sol[i] = c; for (auto j : same[i]) { sol[j] = c; } } } cout << "0 "; for (int i = 1; i <= n; ++i) cout << sol[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...