답안 #104375

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
104375 2019-04-05T18:38:19 Z IVIosab 사육제 (CEOI14_carnival) C++17
100 / 100
11 ms 424 KB
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define mp make_pair
#define ll long long

int vis[155],res[155];

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    vector<int> v;
    v.push_back(1);
    res[1]=1;
    int cnt=2;
    for(int i=2;i<=n;i++){
        v.push_back(i);
        cout<<v.size();
        for(int j=0;j<v.size();j++){
            cout<<" "<<v[j];
        }
        cout<<endl;
        int a;
        cin>>a;
        if(a!=v.size()){
            v.pop_back();
            int l=0,r=v.size()-1;
            for(int k=0;k<20;k++){
                int mid=(l+r)/2;
                cout<<mid-l+2;
                for(int j=l;j<=mid;j++){
                    cout<<" "<<v[j];
                }
                cout<<" "<<i<<endl;
                cin>>a;
                if(a==1){
                    break;
                }
                if(a==mid-l+2){
                    l=mid+1;
                }
                else{
                    r=mid;
                }
            }
            res[i]=res[v[l]];
        }
        else{
            res[i]=cnt;
            cnt++;
        }
    }
    cout<<0;
    for(int i=1;i<=n;i++){
        cout<<" "<<res[i];
    }
    cout<<endl;
    return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:25:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j=0;j<v.size();j++){
                     ~^~~~~~~~~
carnival.cpp:31:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(a!=v.size()){
            ~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 256 KB Output is correct
2 Correct 8 ms 384 KB Output is correct
3 Correct 6 ms 304 KB Output is correct
4 Correct 3 ms 420 KB Output is correct
5 Correct 6 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 9 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 7 ms 384 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 9 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 256 KB Output is correct
2 Correct 6 ms 256 KB Output is correct
3 Correct 6 ms 256 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 6 ms 256 KB Output is correct
6 Correct 7 ms 384 KB Output is correct
7 Correct 10 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 256 KB Output is correct
2 Correct 8 ms 256 KB Output is correct
3 Correct 9 ms 384 KB Output is correct
4 Correct 5 ms 424 KB Output is correct
5 Correct 10 ms 256 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 8 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 11 ms 384 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 7 ms 256 KB Output is correct
5 Correct 8 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 6 ms 384 KB Output is correct