# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
298333 | 2020-09-12T17:36:50 Z | FlashGamezzz | Carnival (CEOI14_carnival) | C++17 | 5 ms | 512 KB |
#include <iostream> #include <cstdlib> #include <cstdio> #include <fstream> #include <algorithm> #include <string> #include <utility> #include <vector> #include <queue> #include <set> #include <map> #include <cassert> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, count = 2, prefs[155], vals[155]; cin >> n; prefs[0] = 1; string s = "1"; for (int i = 1; i < n; i++) { s += " " + to_string(i+1); cout << i+1 << " " << s << endl; cin >> prefs[i]; } vals[0] = 1; for (int i = 1; i < n; i++) { if (prefs[i] == prefs[i-1]+1) { vals[i] = count; count++; } } srand(28); vector<int> nums; for (int i = 0; i < n; i++) { if (vals[i] == 0) { vector<int> temp; for (int a : nums){ temp.push_back(a); } while (temp.size() > 1) { int ind = rand() % temp.size(); assert(ind >= 0 && ind < temp.size()); int v = temp[ind], in; cout << 2 << " " << v << " " << (i+1) << endl; cin >> in; if (in == 1) { vals[i] = v; break; } temp.erase(temp.begin() + ind); } if (vals[i] == 0) { vals[i] = temp[0]; } } else { nums.push_back(vals[i]); } } cout << 0; for (int i = 0; i < n; i++) { cout << " " << vals[i]; } cout << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 384 KB | Integer -32768 violates the range [1, 137] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 512 KB | Integer -32768 violates the range [1, 145] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 384 KB | Same person came twice to the party. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 384 KB | Integer -2113633759 violates the range [1, 143] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 384 KB | Same person came twice to the party. |
2 | Halted | 0 ms | 0 KB | - |