답안 #874801

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
874801 2023-11-17T20:08:26 Z eu_caue 사육제 (CEOI14_carnival) C++14
0 / 100
1 ms 596 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 << 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 << 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:29:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         if(ans == heads.size()+1){
      |            ~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 0 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 0 ms 596 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 0 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 0 ms 412 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -