# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
989343 | 2024-05-28T02:59:46 Z | hansenhe | Carnival (CEOI14_carnival) | C++14 | 1 ms | 344 KB |
#include <bits/stdc++.h> using namespace std; #define int long long vector<int> distinct; bool good(int a, int mid, int num){ // from 1 to mid inclusive cout << mid - a + 2 << " "; for (int i = a - 1; i < mid - 1; i++) cout << distinct[i] << " "; cout << num << "\n"; fflush(stdout); int nwsz; cin >> nwsz; if (nwsz == mid - a + 2) return true; return false; } signed main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<int> bad; for (int i = 1; i <= n; i++){ int ip = distinct.size() + 1; cout << ip << " "; for (int x : distinct) cout << x << " "; cout << i << "\n"; fflush(stdout); int nwsz = 0; cin >> nwsz; if (nwsz == ip){ distinct.push_back(i); } else { bad.push_back(i); } } map<int, vector<int>> mp; for (int i = 1; i <= distinct.size(); i++) mp[i].push_back(distinct[i]); // we now have a list of all distinct costumes for (int k : bad){ int a = 1, b = distinct.size(); int mid = (a + b) / 2; if (good(a, mid, k)){ b = mid; } else { a = mid + 1; } mp[a].push_back(k); } cout << "0 "; vector<int> ans(n); for (auto p : mp){ for (int x : p.second){ ans[x - 1] = p.first; } } for (int x : ans) cout << x << " "; cout << "\n"; fflush(stdout); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 0 ms | 344 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 0 ms | 344 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 0 ms | 344 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 0 ms | 344 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1 ms | 344 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |