Submission #995852

# Submission time Handle Problem Language Result Execution time Memory
995852 2024-06-10T02:49:05 Z toan2602 Carnival (CEOI14_carnival) C++14
0 / 100
6 ms 344 KB
#include<bits/stdc++.h>

using namespace std;

int ask(vector<int> &v) {
    int x;
    cout << v.size() << ' ';
    for (int i: v) cout << i << ' ';
    cout << endl;
    cin >> x;
    return x;
}
bool mark[155];
int col[155];
vector<int> v;
void solve() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) col[i] = i;
    for (int i = 1; i <= n; i++) {
        v.clear();
        int l = i, r = n, mid, pos = 1e9;
        while(l <= r) {
            v.clear();
            mid = (l + r) / 2;
            for (int j = i; j <= mid; j++) {
                v.push_back(j);
            }
            int ans = ask(v);
            if(ans < mid - i + 1) {
                if(ans == mid - i) pos = min(pos, mid);
                r = mid - 1;
            }
            else l = mid + 1;
        }
        if(pos != 1e9) col[pos] = col[i];
        //cout << "DM " << i << ' ' << pos << '\n';
    }
    cout << 0 << ' ';
    for (int i = 1; i <= n; i++) cout << col[i] << ' ';
}

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int t = 1;
    // cin >> t;
    while(t--) {
        solve();
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 344 KB Integer 12 violates the range [1, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 344 KB Integer 6 violates the range [1, 5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 344 KB Output is correct
2 Incorrect 6 ms 344 KB Integer 9 violates the range [1, 8]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 344 KB Integer 5 violates the range [1, 4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 344 KB Integer 5 violates the range [1, 2]
2 Halted 0 ms 0 KB -