Submission #551800

# Submission time Handle Problem Language Result Execution time Memory
551800 2022-04-21T15:03:13 Z hoanghq2004 Carnival (CEOI14_carnival) C++14
0 / 100
12 ms 208 KB
#include <bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;

const int N = 160;

int n, s[N], c[N];

int main() {
    ios :: sync_with_stdio(0); cin.tie(0);
    auto ask = [&](int x, int y) {
        cout << y + 1 << endl;
        for (int i = 1; i <= y; ++i) cout << i << ' ';
        cout << x << endl;
        int z;
        cin >> z;
        return z;
    };
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        int L = 0, R = i - 1;
        while (R - L > 1) {
            int mid = L + R >> 1;
            if (s[mid] != ask(i, mid)) R = mid;
            else L = mid;
        }
        int j = (s[L] != ask(i, L) ? L : R);
        s[i] = s[i - 1];
        if (j == 0) c[i] = ++s[i];
        else c[i] = c[j];
    }
    cout << 0 << ' ';
    for (int i = 1; i <= n; ++i) cout << c[i] << ' ';
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:31:25: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   31 |             int mid = L + R >> 1;
      |                       ~~^~~
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 208 KB Integer 12 violates the range [1, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 208 KB Integer 6 violates the range [1, 5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 208 KB Integer 2 violates the range [1, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 208 KB Integer 5 violates the range [1, 4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 208 KB Integer 3 violates the range [1, 2]
2 Halted 0 ms 0 KB -