Submission #749962

# Submission time Handle Problem Language Result Execution time Memory
749962 2023-05-29T02:25:53 Z huutuan Carnival (CEOI14_carnival) C++14
100 / 100
8 ms 256 KB
#include<bits/stdc++.h>

using namespace std;

#define int long long
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)x.size())
#define sumof(x) accumulate(all(x), 0ll)

const int N=151;
int id[N], n, a[N];

int guess(int x, int y){
    cout << x+1 << ' ';
    for (int i=1; i<=x; ++i) cout << id[i] << ' ';
    cout << y << endl;
    int z; cin >> z;
    return z;
}

void solve(int tc){
    // cout << "Case #" << tc << ": ";
    cin >> n;
    vector<int> v;
    int cc=0;
    for (int i=1; i<=n; ++i){
        int t=guess(cc, i);
        if (t>cc){
            a[i]=++cc;
            id[cc]=i;
        }else{
            int l=1, r=cc;
            while (l<=r){
                int mid=(l+r)>>1ll;
                if (guess(mid, i)==mid) r=mid-1;
                else l=mid+1;
            }
            a[i]=l;
        }
    }
    cout << 0;
    for (int i=1; i<=n; ++i) cout << ' ' << a[i];
    cout << endl;
}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int ntests=1;   
    // cin >> ntests;
    for (int i=1; i<=ntests; ++i) solve(i);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 208 KB Output is correct
2 Correct 6 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 3 ms 208 KB Output is correct
6 Correct 2 ms 208 KB Output is correct
7 Correct 6 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 208 KB Output is correct
2 Correct 8 ms 220 KB Output is correct
3 Correct 4 ms 208 KB Output is correct
4 Correct 3 ms 208 KB Output is correct
5 Correct 4 ms 208 KB Output is correct
6 Correct 6 ms 208 KB Output is correct
7 Correct 5 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 208 KB Output is correct
2 Correct 6 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 208 KB Output is correct
6 Correct 6 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 4 ms 208 KB Output is correct
4 Correct 2 ms 208 KB Output is correct
5 Correct 5 ms 208 KB Output is correct
6 Correct 6 ms 256 KB Output is correct
7 Correct 6 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 208 KB Output is correct
2 Correct 8 ms 208 KB Output is correct
3 Correct 7 ms 208 KB Output is correct
4 Correct 6 ms 208 KB Output is correct
5 Correct 5 ms 208 KB Output is correct
6 Correct 5 ms 208 KB Output is correct
7 Correct 5 ms 208 KB Output is correct