Submission #1188681

#TimeUsernameProblemLanguageResultExecution timeMemory
1188681njoopCarnival (CEOI14_carnival)C++20
20 / 100
15 ms428 KiB
#include <bits/stdc++.h> using namespace std; int n, ans[200], c1, c2, call; //arr[200] = {0, 1, 2, 3, 2, 5, 6, 2, 4, 3, 2, 4, 6, 7, 9, 2, 8, 4, 6, 5, 5, 3, 1}; map<int, int> linked, mp; set<int> s; // int checker(vector<int> v) { // set<int> s2; // cout << v.size() << " "; // for(auto i: v) { // cout << i << " "; // s2.insert(arr[i]); // } // cout << "\n"; // return (int)s2.size(); // } int ask(vector<int> v) { int c; cout << v.size() << " "; for(auto i: v) { cout << i << " "; } cout << endl; cin >> c; return c; // return checker(v); } int main() { vector<int> v; cin >> n; for(int i=1; i<=n; i++) { ans[i] = -1; } int pr=0; for(int i=1; i<=n/2; i++) { v.clear(); for(int j=1; j<=i; j++) v.push_back(j); int c = ask(v); if(c != pr) { pr = c; linked[c] = i; ans[i] = pr; s.insert(pr); } } c1 = pr; pr = 0; for(int i=n/2+1; i<=n; i++) { v.clear(); for(int j=n/2+1; j<=i; j++) v.push_back(j); int c = ask(v); // cout << c << " " << pr << "--\n"; if(c != pr) { pr = c; linked[c+300] = i; ans[i] = pr+300; } } c2 = pr; call = c1; // for(auto i: linked) { // cout << i.first << " " << i.second << "\n"; // } for(int i=1; i<=c1; i++) { v.clear(); for(int j=n/2+1; j<=n; j++) v.push_back(j); v.push_back(linked[i]); int ct = ask(v); if(ct > c2) s.insert(i); } for(int i=1; i<=c2; i++) { int t = -1; for(auto j: s) { v = {linked[j], linked[i+300]}; int t = ask(v); if(t == 1) { mp[i+300] = j; t = j; goto jump; } } jump:; if(t != -1 && s.find(t) != s.end()) s.erase(t); if(mp[i+300] == 0) { call++; mp[i+300] = call; } } for(int i=1; i<=n/2; i++) { if(ans[i] == -1) { for(int j=1; j<=c1; j++) { v = {i, linked[j]}; if(ask(v) == 1) { ans[i] = j; goto j1; } } } j1:; } for(int i=n/2+1; i<=n; i++) { if(ans[i] == -1) { for(int j=1; j<=c2; j++) { v = {i, linked[j+300]}; if(ask(v) == 1) { ans[i] = mp[j+300]; goto j2; } } } j2:; } cout << 0; for(int i=1; i<=n; i++) { if(ans[i] > 300) ans[i] = mp[ans[i]]; cout << " " << ans[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...