답안 #574743

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
574743 2022-06-09T11:34:38 Z RealSnake 사육제 (CEOI14_carnival) C++14
100 / 100
21 ms 208 KB
#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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 208 KB Output is correct
2 Correct 14 ms 208 KB Output is correct
3 Correct 14 ms 208 KB Output is correct
4 Correct 3 ms 208 KB Output is correct
5 Correct 6 ms 208 KB Output is correct
6 Correct 5 ms 208 KB Output is correct
7 Correct 9 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 208 KB Output is correct
2 Correct 17 ms 208 KB Output is correct
3 Correct 10 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 2 ms 208 KB Output is correct
7 Correct 7 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 208 KB Output is correct
2 Correct 9 ms 208 KB Output is correct
3 Correct 11 ms 208 KB Output is correct
4 Correct 5 ms 208 KB Output is correct
5 Correct 4 ms 208 KB Output is correct
6 Correct 4 ms 208 KB Output is correct
7 Correct 17 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 15 ms 208 KB Output is correct
4 Correct 6 ms 208 KB Output is correct
5 Correct 4 ms 208 KB Output is correct
6 Correct 6 ms 208 KB Output is correct
7 Correct 14 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 208 KB Output is correct
2 Correct 13 ms 208 KB Output is correct
3 Correct 21 ms 208 KB Output is correct
4 Correct 15 ms 208 KB Output is correct
5 Correct 6 ms 208 KB Output is correct
6 Correct 3 ms 208 KB Output is correct
7 Correct 8 ms 208 KB Output is correct