답안 #918552

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
918552 2024-01-30T06:34:20 Z vjudge1 사육제 (CEOI14_carnival) C++17
100 / 100
6 ms 1144 KB
#include <bits/stdc++.h> 
using namespace std; 
typedef unsigned long long ull; 
#define ll int
typedef vector < int > vl; 
typedef set < int > setl;
#define F first
#define S second    
#define all(v) v.begin(), v.end() 
#define pll pair < int , int > 
#define db  double
#define nll cout << "\n"
#define nl endl
#define sync                          \
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) ;
const int MAX = 200 + 5; 
const long long inf = 1e18; 
map < vl, ll> mp;
ll n, a[MAX];
ll ask(vl &v){
    if(mp[v])return mp[v];
    cout << v.size() << " ";
    for(auto i : v){
        cout << i << " ";
    }
    nll;
    ll x;
    cin >> x;
    return mp[v] = x;
}
void solve(){
    vl v;
    cin >> n;
    ll x = 0;
    for(ll i = 1; i <= n; i++){
        v.push_back(i);
        ll k = ask(v);
        if(k > x)a[i] = k, x = k; 
        else{
            v.pop_back();
            ll l = 0, r = v.size() - 1;
            while(l < r){
                ll mid = (l + r) / 2;
                vl cur;
                for(ll i = 0; i <= mid; i++){
                    cur.push_back(v[i]);
                }
                ll curr = ask(cur);
                cur.push_back(i);
                ll cur2 = ask(cur);
                if(cur2 == curr){
                    r = mid;
                }
                else l = mid + 1;
            }
            a[i] = a[v[l]];
        }
    }
    cout << "0 ";
    for(ll i = 1; i <= n; i++)cout << a[i] << " ";
}
signed main(){
    ll t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 696 KB Output is correct
2 Correct 4 ms 972 KB Output is correct
3 Correct 3 ms 696 KB Output is correct
4 Correct 2 ms 948 KB Output is correct
5 Correct 2 ms 948 KB Output is correct
6 Correct 1 ms 668 KB Output is correct
7 Correct 4 ms 688 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 688 KB Output is correct
2 Correct 4 ms 736 KB Output is correct
3 Correct 3 ms 688 KB Output is correct
4 Correct 3 ms 436 KB Output is correct
5 Correct 3 ms 432 KB Output is correct
6 Correct 3 ms 952 KB Output is correct
7 Correct 3 ms 688 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 432 KB Output is correct
2 Correct 3 ms 692 KB Output is correct
3 Correct 5 ms 948 KB Output is correct
4 Correct 2 ms 948 KB Output is correct
5 Correct 3 ms 444 KB Output is correct
6 Correct 4 ms 688 KB Output is correct
7 Correct 4 ms 944 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 692 KB Output is correct
2 Correct 3 ms 692 KB Output is correct
3 Correct 3 ms 696 KB Output is correct
4 Correct 2 ms 692 KB Output is correct
5 Correct 4 ms 432 KB Output is correct
6 Correct 3 ms 688 KB Output is correct
7 Correct 4 ms 436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 692 KB Output is correct
2 Correct 4 ms 728 KB Output is correct
3 Correct 6 ms 1112 KB Output is correct
4 Correct 4 ms 1144 KB Output is correct
5 Correct 3 ms 692 KB Output is correct
6 Correct 3 ms 688 KB Output is correct
7 Correct 3 ms 952 KB Output is correct