답안 #257170

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
257170 2020-08-03T16:50:56 Z a_player 사육제 (CEOI14_carnival) C++14
100 / 100
9 ms 384 KB
#include <bits/stdc++.h>

using namespace std;
const int nax=150+5;
int col[nax];
vector<int> dist;
vector<int> sis;
void ric(int l, int r, int val){
    if(l==r){
        col[val-1]=l+1;
        return;
    }
    int m=(r+l)/2;
    cout<<m-l+2<<" ";
    for(int i=l;i<=m;i++)cout<<dist[i]<<" ";
    cout<<val<<endl;
    int h;
    cin>>h;
    if(h==m-l+2)ric(m+1,r,val);
    else ric(l,m,val);
}
int main(){
    int N;
    cin>>N;
    dist.push_back(1);
    for(int i=2;i<=N;i++){
        dist.push_back(i);
        cout<<dist.size()<<" ";
        for(int x:dist)cout<<x<<" ";
        cout<<endl;
        int h;
        cin>>h;
        if(h!=dist.size())dist.pop_back(),sis.push_back(i);
    }
    for(int i=0;i<dist.size();i++)col[dist[i]-1]=i+1;
    for(int x:sis)ric(0,dist.size()-1,x);
    cout<<"0 ";
    for(int i=0;i<N;i++)cout<<col[i]<<" ";

}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:33:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(h!=dist.size())dist.pop_back(),sis.push_back(i);
            ~^~~~~~~~~~~~~
carnival.cpp:35:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<dist.size();i++)col[dist[i]-1]=i+1;
                 ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 6 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
6 Correct 3 ms 256 KB Output is correct
7 Correct 9 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 8 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 7 ms 256 KB Output is correct
7 Correct 8 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 9 ms 256 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 8 ms 256 KB Output is correct
6 Correct 9 ms 256 KB Output is correct
7 Correct 7 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 7 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 7 ms 256 KB Output is correct
6 Correct 6 ms 256 KB Output is correct
7 Correct 7 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 256 KB Output is correct
2 Correct 7 ms 256 KB Output is correct
3 Correct 6 ms 256 KB Output is correct
4 Correct 6 ms 256 KB Output is correct
5 Correct 7 ms 256 KB Output is correct
6 Correct 6 ms 256 KB Output is correct
7 Correct 4 ms 256 KB Output is correct