Submission #257154

# Submission time Handle Problem Language Result Execution time Memory
257154 2020-08-03T16:32:31 Z a_player Carnival (CEOI14_carnival) C++14
0 / 100
459 ms 262148 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]=l;
        return;
    }
    int m=(l+r)/2;
    cout<<m+1<<" ";
    for(int i=0;i<m;i++)cout<<dist[i+l]<<" ";
    cout<<val<<endl;
    int h;
    cin>>h;
    if(h==m)ric(m,r,val);
    else ric(l,m-1,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]]=i;
    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]]=i;
                 ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 451 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 420 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Integer 0 violates the range [1, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 256 KB Integer 0 violates the range [1, 4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 459 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -