제출 #574743

#제출 시각아이디문제언어결과실행 시간메모리
574743RealSnake사육제 (CEOI14_carnival)C++14
100 / 100
21 ms208 KiB
#include "bits/stdc++.h"
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define ll long long
#define mod 1000000007

int ans[151];
bool b[151];

signed main() {

    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n;
    cin >> n;
    int x = 2;
    int a[n + 1];
    a[1] = 1;
    ans[1] = 1;
    for(int i = 2; i <= n; i++) {
        cout << i << " ";
        for(int j = 1; j <= i; j++)
            cout << j << " ";
        cout << endl;
        cin >> a[i];
        if(a[i] != a[i - 1])
            ans[i] = x++;
    }
    for(int i = 1; i <= n; i++) {
        if(b[ans[i]])
            continue;
        b[ans[i]] = 1;
        for(int j = i + 1; j <= n; j++) {
            if(ans[j])
                continue;
            cout << 2 << " " << i << " " << j << endl;
            int y;
            cin >> y;
            if(y == 1)
                ans[j] = ans[i];
        }
    }
    cout << 0 << " ";
    for(int i = 1; i <= n; i++)
        cout << ans[i] << " ";

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...