Submission #909810

# Submission time Handle Problem Language Result Execution time Memory
909810 2024-01-17T12:45:13 Z vjudge1 Carnival (CEOI14_carnival) C++17
100 / 100
4 ms 496 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

vector <ll> ans;

int main () {
    ll n;
    cin >> n;
    ans.resize(n);
    vector <ll> diff;
    diff.push_back(0);
    ll curColor = 0;
    ans[0] = curColor++;
    for (ll i = 1; i < n; i++) {
        cout << diff.size()+1 << ' ';
        for (ll j : diff) cout << j+1 << ' ';
        cout << i+1 << '\n';
        ll res;
        cin >> res;
        if (res == diff.size()+1) {
            diff.push_back(i);
            ans[i] = curColor++;
            continue;
        }
        ll l = 0, r = diff.size();
        while (l+1 < r) {
            ll mid = (l+r)>>1;
            cout << mid+1 << ' ';
            for (ll j = 0; j < mid; j++) cout << diff[j]+1 << ' ';
            cout << i+1 << '\n';
            ll res;
            cin >> res;
            if (res == mid) {
                r = mid;
            } else {
                l = mid;
            }
        }
        ans[i] = ans[diff[l]];
    }
    cout << "0 ";
    for (ll i : ans) cout << i+1 << ' ';
    cout << '\n';
    return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:21:17: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |         if (res == diff.size()+1) {
      |             ~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 3 ms 436 KB Output is correct
3 Correct 3 ms 440 KB Output is correct
4 Correct 2 ms 440 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 496 KB Output is correct
7 Correct 3 ms 440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 2 ms 432 KB Output is correct
4 Correct 2 ms 436 KB Output is correct
5 Correct 3 ms 400 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 2 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 4 ms 436 KB Output is correct
4 Correct 2 ms 436 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 3 ms 436 KB Output is correct
7 Correct 4 ms 436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 2 ms 436 KB Output is correct
4 Correct 3 ms 436 KB Output is correct
5 Correct 3 ms 436 KB Output is correct
6 Correct 4 ms 440 KB Output is correct
7 Correct 3 ms 444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 3 ms 436 KB Output is correct
4 Correct 3 ms 436 KB Output is correct
5 Correct 3 ms 436 KB Output is correct
6 Correct 2 ms 436 KB Output is correct
7 Correct 3 ms 436 KB Output is correct