Submission #918172

# Submission time Handle Problem Language Result Execution time Memory
918172 2024-01-29T13:21:50 Z nasir_bashirov Carnival (CEOI14_carnival) C++11
0 / 100
7 ms 1976 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

#include <bits/stdc++.h>
using namespace std;

#define db long double
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
// #define endl '\n'
#define all(x) x.begin(), x.end()
#define fastio\
    ios_base::sync_with_stdio(0);\
    cin.tie(0);\
    cout.tie(0)\

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
map<vi, int> mp;

int ask(vi &v){
    if(mp[v])   return mp[v];
    cout << v.size() << " ";
    for(int i : v){
        cout << i << " ";
    }
    cout << endl;
    int x;
    cin >> x;
    return mp[v] = x;
}

signed main(){
    int n;
    cin >> n;
    int a[n + 5], pre = 0;
    vi v;
    for(int i = 1; i <= n; i++){
        v.push_back(i);
        int k = ask(v);
        if(k > pre){
            a[i] = k;
            pre = k;
        }
        else{
            int l = 1, r = i - 1, ans = -1;
            while(l < r){
                int mid = (l + r) / 2;
                vi tmp;
                for(int i = 1; i <= mid; i++){
                    tmp.push_back(i);
                }
                int pre = ask(tmp);
                tmp.push_back(i);
                int nw = ask(tmp);
                if(nw == pre){
                    ans = mid;
                    r = mid - 1;
                }
                else{
                    l = mid + 1;
                }
            }
            a[i] = a[ans];
        }
    }
    cout << 0 << " ";
    for(int i = 1; i <= n; i++){
        cout << a[i] << " ";
    }
    cout << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1976 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1300 KB Integer 0 violates the range [1, 5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1208 KB Integer 0 violates the range [1, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 1716 KB Integer 0 violates the range [1, 4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 692 KB Integer 0 violates the range [1, 2]
2 Halted 0 ms 0 KB -