답안 #469838

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
469838 2021-09-02T05:24:11 Z PancakeFactory 사육제 (CEOI14_carnival) C++14
0 / 100
8 ms 312 KB
#include <bits/stdc++.h>
using namespace std;
/* ################################ */
#define pb push_back
#define FOR(i, a, n) for(int i = (a); i < (n); i++)
#define FORN(i, n) for(int i = 0; i < (n); i++)
#define SZ(x) ((int) (x).size())
#define mp(x,y) make_pair((x), (y))
#define xx first
#define yy second
#define clr clear()
#define MOD 1000000007
typedef long long ll;
/* ################################ */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsizeof-array-argument"
template<typename T>void dbg_var(T data){cout<<data<<endl;};
void dbg_vec(const vector<int>& v){FOR(i,0,(int)v.size()){cout<<v[i]<<" ";}cout<<endl;}
void dbg_varlist(const vector<pair<string, int>>& s){FOR(i, 0, (int)s.size()){cout<<s[i].first<<": "<<s[i].second<<" | ";}cout<<endl;}
template <class T, unsigned N> void dbg_arr(T (&arr)[N]){int size = sizeof(arr)/sizeof(arr[0]);FOR(i,0,size){cout<<arr[i]<<" ";}cout<<endl;}
#pragma GCC diagnostic pop
/* ################################ */

vector<int> costumes = {0};
int ans[151] = {0};

int query(int l, int r, int x) {
    cout << (r-l)+2 << " ";
    FOR(i, l, r+1) cout << costumes[i] << " ";
    cout << x << endl;

    cin >> x;
    return x;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n; cin >> n;

    int numSeen = 1;
    costumes.push_back(1);
    ans[1] = 1;

    FOR(i, 2, n+1) {
        if(query(1,numSeen, i) > numSeen) {
            cout << numSeen << endl;
            numSeen++;
            ans[i] = numSeen;
        } else {
            int low = 1, high = costumes.size()-1;
            while(low < high) {
                int mid = low + (high - low) / 2;

                if(query(low, mid+1, i) == numSeen) {
                    high = mid;
                } else {
                    low = mid + 1;
                }
            }

            ans[i] = ans[costumes[low]];
        }
        costumes.push_back(i);
    }

    cout << 0 << " ";
    FOR(i, 1, n+1) cout << ans[i] << " ";
    cout << endl;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 200 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 200 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 312 KB Output is correct
2 Runtime error 1 ms 200 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 200 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 304 KB Incorrect
2 Halted 0 ms 0 KB -