답안 #874795

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
874795 2023-11-17T19:51:14 Z eu_caue 사육제 (CEOI14_carnival) C++14
0 / 100
1 ms 344 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(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n; cin >> n;
    int color = 1, nheads = 0;
    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;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:30:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |         if(ans == heads.size()+1){
      |            ~~~~^~~~~~~~~~~~~~~~~
carnival.cpp:23:20: warning: unused variable 'nheads' [-Wunused-variable]
   23 |     int color = 1, nheads = 0;
      |                    ^~~~~~
# 결과 실행 시간 메모리 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 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 1 ms 340 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 -