답안 #995994

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
995994 2024-06-10T06:48:36 Z vjudge1 사육제 (CEOI14_carnival) C++14
0 / 100
5 ms 596 KB
#include<bits/stdc++.h>
using namespace std;
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<int> first;
    int input;
    first.push_back(1);
    for(int i=2;i<=n;i++){
        cout << first.size()+1 << ' ';
        for(int j=0;j<first.size();j++){
            cout << first[j] << ' ';
        }
        cout << i << endl;
        cin >> input;
        if(input==first.size()+1){
            first.push_back(i);
        }
    }
    int ans[n+1];
    memset(ans,0,sizeof(ans));
    for(int i=0;i<first.size();i++){
        ans[first[i]]=i+1;
    }
    for(int i=1;i<=n;i++){
        if(ans[i]!=0){
            continue;
        }
        int low=1,high=first.size();
        low--;
        high++;
        while(high-low>1){
            int mid=(high-low)/2+low;
            cout << mid+1 << ' ';
            for(int j=0;j<mid;j++){
                cout << first[j] << ' ';
            }
            cout << i << endl;
            cin >> input;
            if(input==mid+1){
                high=mid;
            }
            else{
                low=mid;
            }
        }
        ans[i]=high;
    }
    cout << "0";
    for(int i=1;i<=n;i++){
        cout << ' ' << ans[i];
    }
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:13:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |         for(int j=0;j<first.size();j++){
      |                     ~^~~~~~~~~~~~~
carnival.cpp:18:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |         if(input==first.size()+1){
      |            ~~~~~^~~~~~~~~~~~~~~~
carnival.cpp:24:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     for(int i=0;i<first.size();i++){
      |                 ~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 344 KB Integer 12 violates the range [1, 11]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 344 KB Integer 6 violates the range [1, 5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 344 KB Integer 2 violates the range [1, 1]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 344 KB Integer 5 violates the range [1, 4]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 596 KB Integer 3 violates the range [1, 2]
2 Halted 0 ms 0 KB -