#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define vl vector<ll>
#define vi vector<int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()
#define pb push_back
#define f first
#define s second
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
map<vl, ll>mp;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll tests = 1;
//cin >> tests;
while(tests--)
{
ll n, i, j, k = 0;
cin >> n;
ll ans[n+5];
vl v;
for(i = 1; i <= n; i++){
v.pb(i);
ll a;
if(mp[v])
a = mp[v];
if(!mp[v])
{
cout << v.size() << ' ';
for(auto u : v)
cout << u << ' ';
cout << endl;
cin >> a;
mp[v] = a;
}
if(a <= k)
{
v.pop_back();
ll l = 0, r = (ll)v.size() - 1;
while(l < r)
{
ll mid = (l + r) / 2;
vl vv;
for(j = 0; j <= mid; j++)
vv.pb(v[j]);
cout << vv.size() << ' ';
for(auto u : vv)
cout << u << ' ';
cout << endl;
ll a1;
cin >> a1;
vv.pb(i);
cout << vv.size() << ' ';
for(auto u : vv)
cout << u << ' ';
cout << endl;
ll a2;
cin >> a2;
if(a2 > a1)
l = mid + 1;
else
r = mid;
}
ans[i] = ans[v[l]];
}
else if(a > k)
{
k = a;
ans[i] = k;
}
}
cout << 0 << ' ';
for(i = 1; i <= n; i++)
cout << ans[i] << ' ';
cout << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
968 KB |
Output is correct |
2 |
Correct |
5 ms |
976 KB |
Output is correct |
3 |
Correct |
4 ms |
708 KB |
Output is correct |
4 |
Correct |
2 ms |
708 KB |
Output is correct |
5 |
Correct |
3 ms |
708 KB |
Output is correct |
6 |
Correct |
2 ms |
708 KB |
Output is correct |
7 |
Correct |
5 ms |
1220 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
616 KB |
Output is correct |
2 |
Correct |
8 ms |
1236 KB |
Output is correct |
3 |
Correct |
4 ms |
716 KB |
Output is correct |
4 |
Correct |
3 ms |
704 KB |
Output is correct |
5 |
Correct |
4 ms |
956 KB |
Output is correct |
6 |
Correct |
4 ms |
712 KB |
Output is correct |
7 |
Correct |
4 ms |
708 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
448 KB |
Output is correct |
2 |
Correct |
4 ms |
708 KB |
Output is correct |
3 |
Correct |
6 ms |
960 KB |
Output is correct |
4 |
Correct |
2 ms |
456 KB |
Output is correct |
5 |
Correct |
5 ms |
976 KB |
Output is correct |
6 |
Correct |
5 ms |
1220 KB |
Output is correct |
7 |
Correct |
6 ms |
712 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
456 KB |
Output is correct |
2 |
Correct |
4 ms |
452 KB |
Output is correct |
3 |
Correct |
5 ms |
1256 KB |
Output is correct |
4 |
Correct |
3 ms |
704 KB |
Output is correct |
5 |
Correct |
6 ms |
708 KB |
Output is correct |
6 |
Correct |
5 ms |
984 KB |
Output is correct |
7 |
Correct |
7 ms |
1220 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
704 KB |
Output is correct |
2 |
Correct |
7 ms |
1228 KB |
Output is correct |
3 |
Correct |
7 ms |
1508 KB |
Output is correct |
4 |
Correct |
5 ms |
708 KB |
Output is correct |
5 |
Correct |
4 ms |
708 KB |
Output is correct |
6 |
Correct |
3 ms |
452 KB |
Output is correct |
7 |
Correct |
3 ms |
972 KB |
Output is correct |