답안 #209882

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
209882 2020-03-15T20:37:33 Z thebes 사육제 (CEOI14_carnival) C++14
100 / 100
16 ms 504 KB
#include <bits/stdc++.h>
#define DEBUG 1
using namespace std;

namespace output{
    void __(short x){cout<<x;}
    void __(unsigned x){cout<<x;}
    void __(int x){cout<<x;}
    void __(long long x){cout<<x;}
    void __(unsigned long long x){cout<<x;}
    void __(double x){cout<<x;}
    void __(long double x){cout<<x;}
    void __(char x){cout<<x;}
    void __(const char*x){cout<<x;}
    void __(const string&x){cout<<x;}
    void __(bool x){cout<<(x?"true":"false");}
    template<class S,class T>
    void __(const pair<S,T>&x){__(DEBUG?"(":""),__(x.first),__(DEBUG?", ":" "),__(x.second),__(DEBUG?")":"");}
    template<class T>
    void __(const vector<T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");}
    template<class T>
    void __(const set<T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");}
    template<class T>
    void __(const multiset<T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");}
    template<class S,class T>
    void __(const map<S,T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");}
    void pr(){cout<<"\n";}
    template<class S,class... T>
    void pr(const S&a,const T&...b){__(a);if(sizeof...(b))__(' ');pr(b...);}
}

using namespace output;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<int,char> pic;
typedef pair<double,double> pdd;
typedef pair<ld,ld> pld;
typedef vector<int> vi;
typedef vector<ll> vl;

#define pb push_back
#define fox(i,x,y) for(int i=(x);i<=(y);i++)
#define foxr(i,x,y) for(int i=(y);i>=(x);i--)

const int MN = 155;
int N, i, j, lo, hi, ans[MN];
vi arr, acc;

int qu(){
    printf("%d ",acc.size());
    for(auto v : acc)
        printf("%d ",v);
    printf("\n");
    fflush(stdout);
    int res; scanf("%d",&res);
    return res;
}

int main(){
    scanf("%d",&N);
    for(i=1;i<=N;i++){
        lo = 0, hi = arr.size();
        while(lo<hi){
            int m = (lo+hi)/2;
            acc.clear();
            for(j=lo;j<=m;j++)
                acc.pb(arr[j]);
            acc.pb(i);
            if(qu()==acc.size()) lo=m+1;
            else hi=m;
        }
        ans[i] = lo;
        if(lo==arr.size()) arr.pb(i);
    }
    printf("0 ");
    for(i=1;i<=N;i++)
        printf("%d ",ans[i]+1);
    printf("\n");
    return 0;
}

Compilation message

carnival.cpp: In function 'int qu()':
carnival.cpp:53:28: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type {aka long unsigned int}' [-Wformat=]
     printf("%d ",acc.size());
                  ~~~~~~~~~~^
carnival.cpp: In function 'int main()':
carnival.cpp:72:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if(qu()==acc.size()) lo=m+1;
                ~~~~^~~~~~~~~~~~
carnival.cpp:76:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(lo==arr.size()) arr.pb(i);
            ~~^~~~~~~~~~~~
carnival.cpp: In function 'int qu()':
carnival.cpp:58:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int res; scanf("%d",&res);
              ~~~~~^~~~~~~~~~~
carnival.cpp: In function 'int main()':
carnival.cpp:63:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&N);
     ~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 248 KB Output is correct
2 Correct 11 ms 376 KB Output is correct
3 Correct 14 ms 248 KB Output is correct
4 Correct 14 ms 248 KB Output is correct
5 Correct 14 ms 248 KB Output is correct
6 Correct 7 ms 248 KB Output is correct
7 Correct 13 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 280 KB Output is correct
2 Correct 13 ms 376 KB Output is correct
3 Correct 11 ms 248 KB Output is correct
4 Correct 11 ms 248 KB Output is correct
5 Correct 10 ms 248 KB Output is correct
6 Correct 11 ms 376 KB Output is correct
7 Correct 11 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 376 KB Output is correct
2 Correct 10 ms 380 KB Output is correct
3 Correct 12 ms 248 KB Output is correct
4 Correct 16 ms 244 KB Output is correct
5 Correct 10 ms 376 KB Output is correct
6 Correct 11 ms 248 KB Output is correct
7 Correct 13 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 248 KB Output is correct
2 Correct 10 ms 248 KB Output is correct
3 Correct 15 ms 248 KB Output is correct
4 Correct 14 ms 376 KB Output is correct
5 Correct 12 ms 248 KB Output is correct
6 Correct 12 ms 376 KB Output is correct
7 Correct 13 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 376 KB Output is correct
2 Correct 9 ms 248 KB Output is correct
3 Correct 14 ms 376 KB Output is correct
4 Correct 14 ms 248 KB Output is correct
5 Correct 14 ms 248 KB Output is correct
6 Correct 14 ms 248 KB Output is correct
7 Correct 15 ms 248 KB Output is correct