답안 #954052

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
954052 2024-03-27T07:25:49 Z irmuun 사육제 (CEOI14_carnival) C++17
100 / 100
4 ms 704 KB
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll n;
    cin>>n;
    //find all different
    ll bef=0;
    vector<ll>v,col(n+5,0);
    ll cur=0;
    vector<bool>used(n+5,0);
    for(ll i=1;i<=n;i++){
        cout<<v.size()+1<<' ';
        for(auto j:v){
            cout<<j<<' ';
        }
        cout<<i<<endl;
        ll x;
        cin>>x;
        if(x==v.size()+1){
            col[i]=++cur;
            v.pb(i);
            used[i]=true;
        }
    }
    for(ll i=1;i<=n;i++){
        if(used[i]) continue;
        ll l=0,r=v.size()-1;
        while(l<r){
            ll mid=(l+r)/2;
            cout<<mid+2<<' ';
            for(ll j=0;j<=mid;j++){
                cout<<v[j]<<' ';
            }
            cout<<i<<endl;
            ll x;
            cin>>x;
            if(x==mid+2){
                l=mid+1;
            }
            else{
                r=mid;
            }
        }
        col[i]=l+1;
    }
    cout<<"0 ";
    for(ll i=1;i<=n;i++){
        cout<<col[i]<<' ';
    }
    cout<<endl;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:29:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         if(x==v.size()+1){
      |            ~^~~~~~~~~~~~
carnival.cpp:17:8: warning: unused variable 'bef' [-Wunused-variable]
   17 |     ll bef=0;
      |        ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 3 ms 456 KB Output is correct
3 Correct 3 ms 456 KB Output is correct
4 Correct 1 ms 448 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 4 ms 700 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 2 ms 456 KB Output is correct
4 Correct 2 ms 456 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
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 4 ms 704 KB Output is correct
4 Correct 2 ms 452 KB Output is correct
5 Correct 4 ms 344 KB Output is correct
6 Correct 3 ms 456 KB Output is correct
7 Correct 4 ms 452 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 3 ms 600 KB Output is correct
4 Correct 2 ms 452 KB Output is correct
5 Correct 4 ms 500 KB Output is correct
6 Correct 3 ms 452 KB Output is correct
7 Correct 3 ms 452 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 3 ms 388 KB Output is correct
3 Correct 3 ms 456 KB Output is correct
4 Correct 3 ms 448 KB Output is correct
5 Correct 3 ms 452 KB Output is correct
6 Correct 2 ms 456 KB Output is correct
7 Correct 2 ms 604 KB Output is correct