Submission #151949

# Submission time Handle Problem Language Result Execution time Memory
151949 2019-09-05T15:52:48 Z forestryks Carnival (CEOI14_carnival) C++14
0 / 100
19 ms 504 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
#define rep(i, n) for (int (i) = 0; (i) < (n); ++(i))
#define all(x) (x).begin(), (x).end()
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define f first
#define s second

const int MAXN = 155;
int n;
int a[MAXN];
int cnt[MAXN][MAXN];

int ask(int l, int r) {
    cout << r - l + 1;
    for (int i = l; i <= r; ++i) {
        cout << ' ' << i + 1;
    }
    cout << endl;
    int x;
    cin >> x;
    return x;
}

int main() {
    FAST_IO;
    cin >> n;
    cnt[n - 1][n - 1] = 1;
    fill(a, a + n, -1);
    int last = 1;
    a[n - 1] = 0;
    for (int i = n - 2; i >= 0; --i) {
        for (int j = i + 1; j < n; ++j) {
            int x = ask(i, j);
            if (x != cnt[i + 1][j] + 1) {
                a[i] = a[j];
                break;
            }
        }
        if (a[i] == -1) a[i] = last++;

        set<int> s;
        for (int j = i; j < n; ++j) {
            s.insert(a[j]);
            cnt[i][j] = s.size();
        }
    }

    cout << 0;
    rep(i, n) {
        cout << ' ' << a[i];
    }
    cout << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 292 KB Integer 0 violates the range [1, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 504 KB Integer 0 violates the range [1, 5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 420 KB Integer 0 violates the range [1, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 376 KB Integer 0 violates the range [1, 4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 380 KB Integer 0 violates the range [1, 2]
2 Halted 0 ms 0 KB -