답안 #422549

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
422549 2021-06-10T08:24:08 Z Emin2004 사육제 (CEOI14_carnival) C++14
100 / 100
9 ms 328 KB
#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define pii pair <int, int>
#define pb push_back
#define F first
#define S second
#define ll long long
#define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define M_PI 3.14159265358979323846

const int N = 200005;
const int mod = 1e9 + 7;

int ans[N];

int main() {
    int n, kind = 2;
    cin >> n;
    set<int> dif;
    dif.insert(1);
    ans[1] = 1;
    for(int i = 2; i <= n; i++){
        int m = dif.size() + 1;
        vector<int> v;
        cout << m << " " << i << " ";
        for(auto itr = dif.begin(); itr != dif.end(); itr++){
            cout << *itr << " ";
            v.pb(*itr);
        }
        cout << endl;
        cout.flush();
        int x;
        cin >> x;
        if(x == m){
            ans[i] = kind;
            kind++;
            dif.insert(i);
            continue;
        }
        int l = 0, r = m - 2;
        while(l < r){
            int mid = (l + r) / 2;
            int sz = mid - l + 1;
            cout << sz + 1 << " " << i << " ";
            for(int j = l; j <= mid; j++){
                cout << v[j] << " ";
            }
            cout << endl;
            cout.flush();
            int q;
            cin >> q;
            if(q == sz){
                r = mid;
            }
            else{
                l = mid + 1;
            }
        }
        ans[i] = ans[v[l]];
    }
    cout << "0 ";
    for(int i = 1; i <= n; i++) cout << ans[i] << " ";
    cout.flush();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 200 KB Output is correct
2 Correct 9 ms 200 KB Output is correct
3 Correct 6 ms 200 KB Output is correct
4 Correct 4 ms 308 KB Output is correct
5 Correct 5 ms 200 KB Output is correct
6 Correct 2 ms 200 KB Output is correct
7 Correct 9 ms 300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 200 KB Output is correct
2 Correct 8 ms 200 KB Output is correct
3 Correct 5 ms 304 KB Output is correct
4 Correct 4 ms 300 KB Output is correct
5 Correct 7 ms 200 KB Output is correct
6 Correct 5 ms 200 KB Output is correct
7 Correct 6 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 7 ms 200 KB Output is correct
3 Correct 9 ms 296 KB Output is correct
4 Correct 4 ms 304 KB Output is correct
5 Correct 4 ms 200 KB Output is correct
6 Correct 8 ms 308 KB Output is correct
7 Correct 8 ms 304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 200 KB Output is correct
2 Correct 7 ms 200 KB Output is correct
3 Correct 6 ms 200 KB Output is correct
4 Correct 4 ms 200 KB Output is correct
5 Correct 9 ms 308 KB Output is correct
6 Correct 8 ms 200 KB Output is correct
7 Correct 8 ms 304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 9 ms 200 KB Output is correct
3 Correct 7 ms 304 KB Output is correct
4 Correct 6 ms 200 KB Output is correct
5 Correct 7 ms 200 KB Output is correct
6 Correct 6 ms 328 KB Output is correct
7 Correct 5 ms 200 KB Output is correct