답안 #749963

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
749963 2023-05-29T02:26:09 Z vjudge1 사육제 (CEOI14_carnival) C++14
100 / 100
8 ms 240 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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 208 KB Output is correct
2 Correct 7 ms 208 KB Output is correct
3 Correct 5 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 3 ms 208 KB Output is correct
7 Correct 6 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 208 KB Output is correct
2 Correct 6 ms 208 KB Output is correct
3 Correct 3 ms 208 KB Output is correct
4 Correct 3 ms 240 KB Output is correct
5 Correct 4 ms 208 KB Output is correct
6 Correct 4 ms 208 KB Output is correct
7 Correct 6 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 208 KB Output is correct
2 Correct 6 ms 208 KB Output is correct
3 Correct 5 ms 208 KB Output is correct
4 Correct 3 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
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 208 KB Output is correct
2 Correct 4 ms 208 KB Output is correct
3 Correct 5 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 3 ms 208 KB Output is correct
7 Correct 7 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 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 7 ms 208 KB Output is correct
5 Correct 4 ms 208 KB Output is correct
6 Correct 5 ms 208 KB Output is correct
7 Correct 4 ms 208 KB Output is correct