Submission #750232

#TimeUsernameProblemLanguageResultExecution timeMemory
750232vjudge1Carnival (CEOI14_carnival)C++17
100 / 100
11 ms300 KiB
#include <iostream> #include <vector> #include <utility> #include <sstream> #include <climits> #include <cstring> #define ll long long #define ld long double using namespace std; const ll mod = 1e9 + 7; typedef vector<int> vi; typedef pair<int, int> ii; typedef vector<ii> vii; int main() { // freopen("input_text", "r", stdin); // freopen("output_text", "w", stdout); // ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0); int n; cin >> n; vi color(n, -1); color[0] = 0; vi idx({0}); for (int i = 1; i < n; i++) { int l = 0, r = idx.size() - 1; while (l <= r) { if (l == r) { cout << 2 << " " << idx[l] + 1 << " " << i + 1 << endl; int ans; cin >> ans; if (ans == 1) { color[i] = l; } else { color[i] = idx.size(); idx.push_back(i); } break; } int mid = (l + r) >> 1; cout << mid - l + 2 << " "; for (int j = l; j <= mid; j++) { cout << idx[j] + 1 << " "; } cout << i + 1 << endl; int ans; cin >> ans; if (ans == mid - l + 2) { l = mid + 1; } else { r = mid; } } } cout << "0 "; for (int i = 0; i < n; i++) { cout << color[i] + 1 << ' '; } cout << endl; }
#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...