답안 #1002897

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1002897 2024-06-19T21:13:56 Z codexistent 사육제 (CEOI14_carnival) C++14
100 / 100
6 ms 428 KB
#include <iostream>
#include <vector>
using namespace std;
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define MAXN 155

int main(){
    int n, c; cin >> n;
    cout << n << " "; FOR(i, 1, n) cout << i << " "; cout << endl;
    cin >> c;

    vector<int> r(n + 1), tp;
    FOR(i, 1, n) r[i] = -1;
    r[1] = 1, tp.push_back(1);

    int prev = 1;
    FOR(i, 2, n){
        cout << i << " "; FOR(j, 1, i) cout << j << " "; cout << endl;

        int cur; cin >> cur;
        if(cur != prev){
            r[i] = r[tp[tp.size() - 1]] + 1;
            tp.push_back(i);
        }
        prev = cur;
    }

    FOR(i, 1, n) if(r[i] == -1) {
        int a = 1, b = c;
        while(a < b){
            int m = (a + b) / 2;
            cout << (m + 1) << " " << i << " ";
            FOR(j, 1, m){
                cout << tp[j - 1] << " ";
            }
            cout << endl;

            int x; cin >> x;
            if(x == m) {
                b = m;
            }else{
                a = m + 1;
            }
        }
        //cout << ">> FDAFDSA >> " << a << endl;

        r[i] = a;
    }

    cout << 0 << " ";
    FOR(i, 1, n) cout << r[i] << " ";
    cout << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 4 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 4 ms 344 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 5 ms 428 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 4 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 4 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 6 ms 344 KB Output is correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 4 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 2 ms 344 KB Output is correct