// teddybear's code
// the one who loves NBP
// noe the second
// goal: 0 / 8
// get medal in APIO (like TKN)
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
// prob:
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define FOR(i,n) for (int i = 0; i<n; i++)
using ll = long long;
using ull = unsigned long long;
ll n,m,t;
ll cnt = 0;
const int maxn = 1e5;
const ll mod = 1e9 + 7;
#define Y "YES"
#define N "NO"
int a[1005][1005];
bool visited[1005][1005];
int dist[1005][1005];
int w,h;
int fx[4] = {-1, 1, 0, 0};
int fy[4] = {0, 0, -1, 1};
queue <pair<int,int>> q;
void check()
{
}
void solve()
{
cin >> n;
set <int> st;
vector <int> res;
vector <int> ans(n+1);
int tmp;
for (int i = 1; i<=n; i++)
{
cout << (int)res.size() + 1 << ' ';
for (int j = 0; j<(int)res.size(); j++)
{
cout << res[j] << ' ';
}
cout << i << '\n';
cin >> tmp;
int tmp2;
if (tmp == res.size() + 1)
{
ans[i] = tmp;
res.push_back(tmp);
}
else
{
int l = 0, r = res.size() - 1;
if (l == r)
{
ans[i] = ans[1];
continue;
}
while (l < r)
{
int mid = (l + r) / 2;
cout << mid - l + 2 << ' ';
for (int j = l; j<=mid; j++)
{
cout << res[j] << ' ';
}
cout << i << '\n';
//cout << flush;
cin >> tmp2;
if (tmp2 == 1)
{
//res[i] = res[l];
ans[i] = ans[res[l]];
break;
}
if (tmp2 == mid - l + 1)
{
r = mid;
}
else
{
cout << r - mid + 1 << ' ';
for (int j = mid + 1; j<=r; j++)
{
cout << res[j] << ' ';
}
cout << i << '\n';
cin >> tmp2;
if (tmp2 == 1)
{
ans[i] = ans[res[r]];
break;
}
if (tmp2 == r - mid)
{
l = mid + 1;
}
}
}
}
}
cout << 0 << ' ';
for (int i = 1; i<=n; i++)
{
cout << ans[i] << ' ';
}
return;
}
void init()
{
int te = 1;
while (te--)
{
solve();
}
}
void preprocess()
{
}
int main()
{
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
//cin.tie(0); cout.tie(0);
//freopen(".inp", "r", stdin);
//freopen(".out", "w", stdout);
init();
preprocess();
//solve();
return 0;
}
Compilation message
carnival.cpp: In function 'void solve()':
carnival.cpp:55:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
55 | if (tmp == res.size() + 1)
| ~~~~^~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
52 ms |
300 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
117 ms |
292 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
208 KB |
Output is correct |
2 |
Runtime error |
121 ms |
292 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
74 ms |
288 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
208 KB |
Output is correct |
2 |
Runtime error |
98 ms |
208 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |