Submission #874803

# Submission time Handle Problem Language Result Execution time Memory
874803 2023-11-17T20:11:24 Z eu_caue Carnival (CEOI14_carnival) C++14
100 / 100
5 ms 848 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int maxn = 155;
int pai[maxn], peso[maxn], colors[maxn];
vector<int> heads;

int query(int tl, int tr, int i){
    if(tl == tr) return heads[tl];
    int mid = (tl+tr)>>1;
    cout << mid - tl + 2 << ' ';
    cout << i << ' ';
    for(int j = tl; j <= mid; j++) cout << heads[j] << ' ';
    cout << endl;
    int ans; cin >> ans;
    if(ans == mid-tl+1) return query(tl, mid, i);
    return query(mid+1, tr, i);
}

int main(){
    int n; cin >> n;
    int color = 1;
    for(int i = 1; i <= n; i++) pai[i] = i;
    for(int i = 1; i <= n; i++){
        cout << heads.size()+1 << ' ';
        cout << i << ' ';
        for(int k : heads) cout << k << ' ';
        cout << endl;
        int ans; cin >> ans;
        if(ans == heads.size()+1){
            colors[i] = color;
            color++;
            heads.push_back(i);
            continue;
        }
        pai[i] = query(0, heads.size(), i);
    }
    for(int i = 0; i <= n; i++) cout << colors[pai[i]] << ' ';
    cout << endl;
    return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:31:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         if(ans == heads.size()+1){
      |            ~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 3 ms 848 KB Output is correct
3 Correct 2 ms 596 KB Output is correct
4 Correct 1 ms 440 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 3 ms 344 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 344 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 2 ms 440 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 3 ms 344 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 344 KB Output is correct
4 Correct 1 ms 440 KB Output is correct
5 Correct 4 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 4 ms 344 KB Output is correct
3 Correct 5 ms 596 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 3 ms 604 KB Output is correct
7 Correct 2 ms 440 KB Output is correct