답안 #918631

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
918631 2024-01-30T08:01:11 Z vjudge1 사육제 (CEOI14_carnival) C++17
100 / 100
7 ms 1764 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 984 KB Output is correct
2 Correct 5 ms 980 KB Output is correct
3 Correct 3 ms 732 KB Output is correct
4 Correct 2 ms 728 KB Output is correct
5 Correct 2 ms 468 KB Output is correct
6 Correct 2 ms 732 KB Output is correct
7 Correct 6 ms 1764 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 980 KB Output is correct
2 Correct 6 ms 1236 KB Output is correct
3 Correct 4 ms 1240 KB Output is correct
4 Correct 2 ms 732 KB Output is correct
5 Correct 4 ms 728 KB Output is correct
6 Correct 4 ms 980 KB Output is correct
7 Correct 6 ms 476 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 980 KB Output is correct
2 Correct 4 ms 728 KB Output is correct
3 Correct 6 ms 992 KB Output is correct
4 Correct 2 ms 980 KB Output is correct
5 Correct 6 ms 1248 KB Output is correct
6 Correct 4 ms 728 KB Output is correct
7 Correct 7 ms 1008 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 728 KB Output is correct
2 Correct 4 ms 976 KB Output is correct
3 Correct 4 ms 980 KB Output is correct
4 Correct 2 ms 928 KB Output is correct
5 Correct 5 ms 988 KB Output is correct
6 Correct 6 ms 1236 KB Output is correct
7 Correct 6 ms 992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 732 KB Output is correct
2 Correct 5 ms 860 KB Output is correct
3 Correct 5 ms 752 KB Output is correct
4 Correct 5 ms 768 KB Output is correct
5 Correct 4 ms 772 KB Output is correct
6 Correct 3 ms 980 KB Output is correct
7 Correct 2 ms 984 KB Output is correct