Submission #996192

# Submission time Handle Problem Language Result Execution time Memory
996192 2024-06-10T08:38:19 Z vjudge1 Carnival (CEOI14_carnival) C++17
100 / 100
14 ms 2508 KB
#include <bits/stdc++.h>
#include<unordered_map>
#define pll pair<ll, ll>
#define ll long long
#define int long long
#define pb push_back
#define ff first
#define ss second
#define ins insert
#define pll2 pair<pair<ll,ll>,ll>
#define bit(i,k) (k>>i)&1
using namespace std;
const long long mod = 1e9 + 7;
const ll maxN = 3e6;
const ll inf = 1e18;
ll pre[maxN];
ll type[maxN];
void solve() {
    ll n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cout << i;
        for (int j = 1; j <= i; j++) {
            cout << " " << j;
        }
        cout << endl;
        cin >> pre[i];
    }

    ll cur = 0;
    for (int i = 1; i <= n; i++) {
        ll l = 0, r = i-1;
        ll mx = 0;
        while (l <= r) {
            ll md = (l + r) / 2;
            cout << md +1 << " ";
            for (int j = 1; j <= md; j++) {
                cout << j << " ";
            }
                cout << i;
            cout << endl;
            ll x;
            cin >> x;
            
            if (pre[md] + 1 == x) {
                l = md + 1;
                mx = max(mx, md);
            }
            else {
                r = md - 1;
                
            }
        }

        if (mx+1 == i) {
            cur++;
            type[i] = cur;
        }
        else {
            type[i] = type[mx+1];
        }

    }
    cout << 0 << " ";
    for (int i = 1; i <= n; i++) {
        cout << type[i] << " ";
    }
    cout << endl;


}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //  freopen("09.inp", "r", stdin);
    // freopen("09.out", "w", stdout);
    ll nhim = 1;
    //cin >> nhim;
    while (nhim--) {
        solve();
    }
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 2392 KB Output is correct
2 Correct 8 ms 2392 KB Output is correct
3 Correct 7 ms 2392 KB Output is correct
4 Correct 7 ms 2392 KB Output is correct
5 Correct 6 ms 2388 KB Output is correct
6 Correct 5 ms 2392 KB Output is correct
7 Correct 9 ms 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 2392 KB Output is correct
2 Correct 7 ms 2392 KB Output is correct
3 Correct 6 ms 2392 KB Output is correct
4 Correct 8 ms 2392 KB Output is correct
5 Correct 6 ms 2392 KB Output is correct
6 Correct 8 ms 2392 KB Output is correct
7 Correct 7 ms 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 2392 KB Output is correct
2 Correct 5 ms 2392 KB Output is correct
3 Correct 8 ms 2504 KB Output is correct
4 Correct 10 ms 2392 KB Output is correct
5 Correct 7 ms 2392 KB Output is correct
6 Correct 10 ms 2392 KB Output is correct
7 Correct 6 ms 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 2392 KB Output is correct
2 Correct 5 ms 2508 KB Output is correct
3 Correct 8 ms 2392 KB Output is correct
4 Correct 14 ms 2392 KB Output is correct
5 Correct 6 ms 2392 KB Output is correct
6 Correct 10 ms 2392 KB Output is correct
7 Correct 10 ms 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2392 KB Output is correct
2 Correct 7 ms 2392 KB Output is correct
3 Correct 10 ms 2392 KB Output is correct
4 Correct 12 ms 2392 KB Output is correct
5 Correct 8 ms 2392 KB Output is correct
6 Correct 9 ms 2392 KB Output is correct
7 Correct 8 ms 2392 KB Output is correct