답안 #916443

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
916443 2024-01-25T23:41:01 Z biank 사육제 (CEOI14_carnival) C++14
100 / 100
6 ms 948 KB
#include <bits/stdc++.h>
using namespace std;
#define SIZE(x) (int)x.size()
#define forn(i,n) for(int i=0;i<int(n);i++)
#define pb push_back

typedef vector<int> vi;

int query(vi &a) {
    if(SIZE(a)<=1) return SIZE(a);
    cout << SIZE(a) << ' ';
    forn(i,SIZE(a)) cout << a[i] << ' ';
    cout << endl;
    int C;
    cin >> C;
    return C;
}

int main() {
    int n; cin >> n;
    int prev = 0;
    vi c, pref;
    vi ans(n);
    
    forn(i,n) {
        pref.pb(i+1);
        int curr=query(pref);
        if(curr!=prev) {
            c.pb(i+1);
            ans[i]=SIZE(c);
        } else {
            int l=0, r=SIZE(c);
            while(l+1<r) {
                int m=(l+r)/2;
                vi q(c.begin(),c.begin()+m);
                q.pb(i+1);
                if(query(q)==m) r=m;
                else l=m;
            }
            ans[i]=r;
        }
        prev=curr;
    }
    
    cout << "0 ";
    forn(i,n) cout << ans[i] << ' ';
    cout << endl;
    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 432 KB Output is correct
2 Correct 3 ms 432 KB Output is correct
3 Correct 2 ms 444 KB Output is correct
4 Correct 2 ms 444 KB Output is correct
5 Correct 2 ms 436 KB Output is correct
6 Correct 2 ms 432 KB Output is correct
7 Correct 3 ms 432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 436 KB Output is correct
2 Correct 4 ms 432 KB Output is correct
3 Correct 3 ms 856 KB Output is correct
4 Correct 2 ms 448 KB Output is correct
5 Correct 3 ms 436 KB Output is correct
6 Correct 2 ms 432 KB Output is correct
7 Correct 6 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 436 KB Output is correct
2 Correct 4 ms 432 KB Output is correct
3 Correct 5 ms 444 KB Output is correct
4 Correct 2 ms 436 KB Output is correct
5 Correct 3 ms 432 KB Output is correct
6 Correct 3 ms 432 KB Output is correct
7 Correct 4 ms 692 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 432 KB Output is correct
2 Correct 3 ms 432 KB Output is correct
3 Correct 3 ms 692 KB Output is correct
4 Correct 2 ms 440 KB Output is correct
5 Correct 3 ms 432 KB Output is correct
6 Correct 3 ms 436 KB Output is correct
7 Correct 4 ms 436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 436 KB Output is correct
2 Correct 4 ms 436 KB Output is correct
3 Correct 4 ms 948 KB Output is correct
4 Correct 3 ms 884 KB Output is correct
5 Correct 3 ms 436 KB Output is correct
6 Correct 4 ms 600 KB Output is correct
7 Correct 2 ms 436 KB Output is correct