Submission #374216

# Submission time Handle Problem Language Result Execution time Memory
374216 2021-03-06T22:41:56 Z MilosMilutinovic Carnival (CEOI14_carnival) C++14
100 / 100
11 ms 492 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
const int N=200;
int ans[N];
vector<int> dif;
void Add(int i){
    cout<<(int)dif.size()+1<<" ";
    for(int j:dif)cout<<j<<" ";
    cout<<i<<endl;
    int sz;cin>>sz;
    if(sz>(int)dif.size())ans[i]=sz,dif.pb(i);
}
bool Can(int pos,int j){
    cout<<pos+2<<" ";
    for(int i=0;i<=pos;i++)cout<<dif[i]<<" ";
    cout<<j<<endl;
    int sz;cin>>sz;
    return sz<pos+2;
}
int main(){
    int n;cin>>n;
    for(int i=1;i<=n;i++)Add(i);
    for(int i=1;i<=n;i++){
        if(ans[i])continue;
        int bot=0,top=(int)dif.size()-1,pos=0;
        while(bot<=top){
            int mid=bot+top>>1;
            if(Can(mid,i))pos=mid,top=mid-1;
            else bot=mid+1;
        }
        ans[i]=ans[dif[pos]];
    }
    cout<<0<<" ";
    for(int i=1;i<=n;i++)cout<<ans[i]<<" ";
    cout<<endl;
    return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:28:24: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   28 |             int mid=bot+top>>1;
      |                     ~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 7 ms 384 KB Output is correct
2 Correct 8 ms 384 KB Output is correct
3 Correct 8 ms 364 KB Output is correct
4 Correct 3 ms 364 KB Output is correct
5 Correct 4 ms 364 KB Output is correct
6 Correct 2 ms 364 KB Output is correct
7 Correct 7 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 364 KB Output is correct
2 Correct 7 ms 364 KB Output is correct
3 Correct 5 ms 364 KB Output is correct
4 Correct 4 ms 364 KB Output is correct
5 Correct 7 ms 364 KB Output is correct
6 Correct 6 ms 364 KB Output is correct
7 Correct 4 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 364 KB Output is correct
2 Correct 7 ms 384 KB Output is correct
3 Correct 11 ms 364 KB Output is correct
4 Correct 5 ms 364 KB Output is correct
5 Correct 7 ms 364 KB Output is correct
6 Correct 10 ms 364 KB Output is correct
7 Correct 11 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 364 KB Output is correct
2 Correct 6 ms 364 KB Output is correct
3 Correct 6 ms 364 KB Output is correct
4 Correct 4 ms 364 KB Output is correct
5 Correct 8 ms 364 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 11 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 364 KB Output is correct
2 Correct 8 ms 364 KB Output is correct
3 Correct 10 ms 364 KB Output is correct
4 Correct 7 ms 364 KB Output is correct
5 Correct 7 ms 364 KB Output is correct
6 Correct 5 ms 364 KB Output is correct
7 Correct 5 ms 384 KB Output is correct