# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
724756 | 2023-04-15T22:50:21 Z | hyakup | Carnival (CEOI14_carnival) | C++17 | 8 ms | 292 KB |
#include <bits/stdc++.h> using namespace std; const int maxn = 160; int v[maxn]; int cont; vector<int> lista; bool queryInit( int id ){ cout << lista.size() + 1 << " "; for( int x : lista ) cout << x << " "; cout << id << endl; cout.flush(); int resp; cin >> resp; return ( resp == lista.size() + 1 ); } bool query( int l, int r, int id ){ cout << r - l + 2 << " "; for( int i = l; i <= r; i++ ) cout << lista[i] << " "; cout << id << endl; cout.flush(); int resp; cin >> resp; return ( resp != r - l + 2 ); } void solve( int id ){ if( queryInit(id) ){ v[id] = ++cont; lista.push_back(id); return; } int l = 0, r = lista.size() - 1; while( l < r ){ int mid = ( l + r )/2; if( query( l, mid, id ) ) r = mid; else l = mid + 1; } v[id] = v[lista[r]]; } int main(){ int n; cin >> n; for( int i = 1; i <= n; i++ ) solve(i); cout << 0 << " "; for( int i = 1; i <= n; i++ ) cout << v[i] << " "; } // 1 2 1 3 2
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 236 KB | Output is correct |
2 | Correct | 7 ms | 208 KB | Output is correct |
3 | Correct | 4 ms | 208 KB | Output is correct |
4 | Correct | 3 ms | 292 KB | Output is correct |
5 | Correct | 5 ms | 208 KB | Output is correct |
6 | Correct | 3 ms | 256 KB | Output is correct |
7 | Correct | 7 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 208 KB | Output is correct |
2 | Correct | 7 ms | 208 KB | Output is correct |
3 | Correct | 4 ms | 208 KB | Output is correct |
4 | Correct | 3 ms | 208 KB | Output is correct |
5 | Correct | 8 ms | 208 KB | Output is correct |
6 | Correct | 8 ms | 208 KB | Output is correct |
7 | Correct | 7 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 208 KB | Output is correct |
2 | Correct | 7 ms | 208 KB | Output is correct |
3 | Correct | 8 ms | 208 KB | Output is correct |
4 | Correct | 3 ms | 208 KB | Output is correct |
5 | Correct | 6 ms | 220 KB | Output is correct |
6 | Correct | 7 ms | 208 KB | Output is correct |
7 | Correct | 7 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 208 KB | Output is correct |
2 | Correct | 6 ms | 208 KB | Output is correct |
3 | Correct | 7 ms | 208 KB | Output is correct |
4 | Correct | 3 ms | 208 KB | Output is correct |
5 | Correct | 7 ms | 208 KB | Output is correct |
6 | Correct | 5 ms | 208 KB | Output is correct |
7 | Correct | 6 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 208 KB | Output is correct |
2 | Correct | 6 ms | 208 KB | Output is correct |
3 | Correct | 6 ms | 208 KB | Output is correct |
4 | Correct | 5 ms | 208 KB | Output is correct |
5 | Correct | 8 ms | 208 KB | Output is correct |
6 | Correct | 5 ms | 208 KB | Output is correct |
7 | Correct | 3 ms | 208 KB | Output is correct |