답안 #918607

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
918607 2024-01-30T07:28:59 Z vjudge1 사육제 (CEOI14_carnival) C++17
100 / 100
7 ms 1496 KB
///designed by NeoRoyal
///www.neoroyal.site
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define ppb pop_back()
#define ppf pop_front()
#define vpl vector<pair<ll,ll>>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define F first
#define S second
#define in insert
#define mp make_pair
#define vll vector<ll>
#define vint vector<int>
#define vs vector<string>
#define vbl vector<bool>
#define sll set<ll>
#define ss set<string>
#define mll map<ll, ll>
#define msl multiset<ll>
#define pque priority_queue
#define all(v) v.begin(),v.end()
#define rall(v) (v).rbegin(),(v).rend()
#define np next_permutation
#define sz(q) sizeof(q)/sizeof(q[0])
#define INF 0x3F3F3F3F
#define MAX 1e10
#define LOG 17
#define lb lower_bound
#define ub upper_bound
#define mem(q, p) memset(q, p, sizeof(q))
#define maxel *max_element
#define minel *min_element
#define yes cout << "YES\n"
#define no cout << "NO\n"
const int MOD = 1e9 + 7;
const int maxn = 5e5 + 5;
const int logn = 19;
const int sz = 150005;
const int width = 3;

///gcd & lcm
ll gcd(ll q, ll p){ return p == 0 ? q : gcd(p, q%p); }
ll lcm(ll q, ll p){ return q*p / gcd(q, p); }

using namespace std;
ll i, j;
void neoroyal(){
    ll mx=0, n; cin>>n;
    vll v, ans(n+1);
    map<vll, ll> mp;
    for(i=1; i<=n; i++){
        v.pb(i); ll x;
        if(!mp[v]){
            cout << v.size() << ' ';
            for(auto &i:v) cout << i << ' ';
            cout << endl;
            cin>>x;
            mp[v] = x;
        } else {
            x = mp[v];
        }
        if(x <= mx){
            v.ppb;
            ll cur, l, r;
            l = 0, r = v.size()-1;
            while(l < r){
                ll mid = (l+r)/2;
                cout << mid+1 << ' ';
                for(j=0; j<=mid; j++){
                    cout << v[j] << ' ';
                }
                cout << endl;
                cin >> cur;
                cout << mid+2 << ' ';
                for(j=0; j<=mid; j++){
                    cout << v[j] << ' ';
                }
                cout << i << endl;
                ll curr; cin >> curr;
                cur >= curr ? r=mid : l = mid+1;
            }
            ans[i] = ans[v[l]];
        }
        else{
            mx = x; ans[i] = mx;
        }
    }
    cout << "0 ";
    for(i=1; i<=n; i++){
        cout << ans[i] << ' ' ;
    }
    cout << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ///cout.setf(std::ios::fixed); cout.precision(4);
    system("color 0A");

    ///
    neoroyal();
    /// ll tests; cin>>tests; while(tests--) neoroyal();
    /// cout<<ans<<endl;

    //system("pause");
}

/**
    ░█████╗░░░░░░░░░░░░░░░
    ██╔══██╗░░██╗░░░░██╗░░
    ██║░░╚═╝██████╗██████╗
    ██║░░██╗╚═██╔═╝╚═██╔═╝
    ╚█████╔╝░░╚═╝░░░░╚═╝░░
    ░╚════╝░░░░░░░░░░░░░░░
**/

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:104:11: warning: ignoring return value of 'int system(const char*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  104 |     system("color 0A");
      |     ~~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 724 KB Output is correct
2 Correct 7 ms 724 KB Output is correct
3 Correct 4 ms 1012 KB Output is correct
4 Correct 2 ms 724 KB Output is correct
5 Correct 3 ms 720 KB Output is correct
6 Correct 2 ms 472 KB Output is correct
7 Correct 5 ms 732 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 724 KB Output is correct
2 Correct 7 ms 1496 KB Output is correct
3 Correct 3 ms 1000 KB Output is correct
4 Correct 2 ms 724 KB Output is correct
5 Correct 4 ms 1240 KB Output is correct
6 Correct 4 ms 740 KB Output is correct
7 Correct 5 ms 980 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 728 KB Output is correct
2 Correct 3 ms 984 KB Output is correct
3 Correct 6 ms 736 KB Output is correct
4 Correct 2 ms 472 KB Output is correct
5 Correct 5 ms 984 KB Output is correct
6 Correct 5 ms 1236 KB Output is correct
7 Correct 5 ms 724 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 724 KB Output is correct
2 Correct 4 ms 732 KB Output is correct
3 Correct 4 ms 736 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 6 ms 984 KB Output is correct
6 Correct 5 ms 724 KB Output is correct
7 Correct 6 ms 1236 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 724 KB Output is correct
2 Correct 5 ms 744 KB Output is correct
3 Correct 5 ms 1256 KB Output is correct
4 Correct 5 ms 728 KB Output is correct
5 Correct 6 ms 888 KB Output is correct
6 Correct 3 ms 724 KB Output is correct
7 Correct 3 ms 528 KB Output is correct