Submission #1015913

# Submission time Handle Problem Language Result Execution time Memory
1015913 2024-07-07T04:36:35 Z vjudge1 Carnival (CEOI14_carnival) C++17
100 / 100
14 ms 856 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
// #define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define nl "\n"
 
vector<int> vec(int start, int end){
    vector<int> v;
    for (int i=start; i<=end; i++) v.push_back(i);
    return v;
}
 
int query(int k, vector<int> v){
    cout << k << " ";
    for (auto i : v) cout << i << " ";
    cout << endl;
    int c;
    cin >> c;
    return c;
}
 
void answer(vector<int> v){
    cout << "0 ";
    for (auto i : v) cout << i << " ";
    cout << endl;
}
 
signed main(){
    int n;
    cin >> n;
    vector<int> costumes;
    // set person 1 to have  costume 1
    int curmax = 1;
    costumes.push_back(1);
    for (int i=2; i<=n; i++){
        //for person i
        int lower = 1, upper = i-1;
        while(upper-lower>0){
            int mid = (lower+upper)/2;
            vector<int> to_query = vec(lower, mid);
            to_query.push_back(i);
            if(query(mid-lower+1, vec(lower, mid))==query(mid-lower+2, to_query)) upper = mid;
            else lower = mid+1;
        }
        vector<int> too_query;
        too_query.push_back(i);
        too_query.push_back(lower);
        if(query(2, too_query)==1) costumes.push_back(costumes[lower-1]);
        else{
            costumes.push_back(curmax+1);
            curmax++;
        }
    }
    answer(costumes);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 10 ms 604 KB Output is correct
2 Correct 10 ms 440 KB Output is correct
3 Correct 11 ms 344 KB Output is correct
4 Correct 12 ms 344 KB Output is correct
5 Correct 9 ms 344 KB Output is correct
6 Correct 9 ms 436 KB Output is correct
7 Correct 9 ms 448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 440 KB Output is correct
2 Correct 13 ms 444 KB Output is correct
3 Correct 6 ms 344 KB Output is correct
4 Correct 12 ms 444 KB Output is correct
5 Correct 14 ms 344 KB Output is correct
6 Correct 11 ms 704 KB Output is correct
7 Correct 10 ms 436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 440 KB Output is correct
2 Correct 9 ms 856 KB Output is correct
3 Correct 12 ms 448 KB Output is correct
4 Correct 10 ms 344 KB Output is correct
5 Correct 14 ms 440 KB Output is correct
6 Correct 9 ms 344 KB Output is correct
7 Correct 9 ms 440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 600 KB Output is correct
2 Correct 14 ms 344 KB Output is correct
3 Correct 12 ms 604 KB Output is correct
4 Correct 9 ms 600 KB Output is correct
5 Correct 10 ms 444 KB Output is correct
6 Correct 10 ms 344 KB Output is correct
7 Correct 12 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 692 KB Output is correct
2 Correct 11 ms 852 KB Output is correct
3 Correct 11 ms 340 KB Output is correct
4 Correct 8 ms 688 KB Output is correct
5 Correct 8 ms 444 KB Output is correct
6 Correct 8 ms 344 KB Output is correct
7 Correct 9 ms 692 KB Output is correct