Submission #939429

# Submission time Handle Problem Language Result Execution time Memory
939429 2024-03-06T10:59:00 Z JakobZorz Carnival (CEOI14_carnival) C++17
100 / 100
8 ms 700 KB
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<limits.h>
#include<math.h>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<iomanip>
#include<cstring>
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;
 
int res[150];
 
int query(vector<int>vec){
    cout<<vec.size()<<endl;
    for(int i:vec)
        cout<<i+1<<" ";
    cout<<endl;
    int r;
    cin>>r;
    return r;
}
 
void get(int c1,int c2,vector<int>p){ // assign people colors from [c1, c2)
    if(c1+1==c2){
        for(int i:p)
            res[i]=c1;
        return;
    }
    int c=(c1+c2)/2;
    vector<int>p1,p2;
    for(int i:p){
        p1.push_back(i);
        if(query(p1)>c-c1){
            p1.pop_back();
            p2.push_back(i);
        }
    }
    get(c1,c,p1);
    get(c,c2,p2);
}
 
void solve(){
    int n,c;
    cin>>n;
    vector<int>all;
    for(int i=0;i<n;i++)
        all.push_back(i);
    c=query(all);
    get(1,c+1,all);
    cout<<0<<endl;
    for(int i=0;i<n;i++)
        cout<<res[i]<<" ";
    cout<<endl;
}
 
int main(){
    //ios::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);
    //freopen("/Users/jakob/cp_testing/test.txt","r",stdin);freopen("output.out","w",stdout);
    int t=1;//cin>>t;
    while(t--)solve();
    return 0;
}
 
/*
 
 */
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 4 ms 440 KB Output is correct
3 Correct 6 ms 436 KB Output is correct
4 Correct 5 ms 444 KB Output is correct
5 Correct 2 ms 432 KB Output is correct
6 Correct 2 ms 444 KB Output is correct
7 Correct 4 ms 440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 436 KB Output is correct
2 Correct 4 ms 436 KB Output is correct
3 Correct 3 ms 436 KB Output is correct
4 Correct 6 ms 440 KB Output is correct
5 Correct 4 ms 696 KB Output is correct
6 Correct 4 ms 700 KB Output is correct
7 Correct 4 ms 440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 2 ms 440 KB Output is correct
3 Correct 5 ms 444 KB Output is correct
4 Correct 7 ms 440 KB Output is correct
5 Correct 4 ms 440 KB Output is correct
6 Correct 7 ms 600 KB Output is correct
7 Correct 4 ms 440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 436 KB Output is correct
2 Correct 2 ms 444 KB Output is correct
3 Correct 7 ms 440 KB Output is correct
4 Correct 5 ms 440 KB Output is correct
5 Correct 7 ms 448 KB Output is correct
6 Correct 5 ms 696 KB Output is correct
7 Correct 4 ms 436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 440 KB Output is correct
2 Correct 3 ms 440 KB Output is correct
3 Correct 5 ms 440 KB Output is correct
4 Correct 5 ms 440 KB Output is correct
5 Correct 5 ms 444 KB Output is correct
6 Correct 6 ms 440 KB Output is correct
7 Correct 8 ms 440 KB Output is correct