# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
533259 | devariaota | Carnival (CEOI14_carnival) | C++17 | 17 ms | 296 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
#pragma GCC optimize("Ofast")
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define sc second
#define gl ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
int n;
cin >> n;
vi baru, uda;
for(int i = 1; i <= n; i++){
cout << baru.size() + 1;
for(int j = 0; j < baru.size(); j++)
cout << " " << baru[j];
cout << " " << i;
cout << endl;
int jawab; cin >> jawab;
if(jawab == baru.size() + 1)
baru.pb(i);
else uda.pb(i);
}
int warna[155];
for(int i = 0; i < baru.size(); i++)
warna[baru[i]] = i + 1;
for(int i = 0; i < uda.size(); i++){
int cur = uda[i];
int l = 0, r = baru.size();
int ans = -1;
while(l <= r){
int m = (l + r)/2;
cout << m + 2 << " " << cur;
for(int j = 0; j <= m; j++)
cout << " " << baru[j];
cout << endl;
int jawab; cin >> jawab;
if(jawab == m + 1){
ans = m;
r = m - 1;
}
else l = m + 1;
}
warna[cur] = ans + 1;
}
cout << 0;
for(int i = 1; i <= n; i++) cout << " " << warna[i];
cout << endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |