답안 #225956

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
225956 2020-04-22T05:14:54 Z balbit Park (JOI17_park) C++14
0 / 100
939 ms 1016 KB
#include <bits/stdc++.h>
#ifndef BALBIT
#include "park.h"
#endif // BALBIT
using namespace std;

#define ll long long
#define pii pair<int,int>
#define f first
#define s second
#define SZ(x) (int)(x.size())
#define ALL(x) x.begin(),x.end()
#define pb push_back

#ifdef BALBIT
#define bug(...) cerr<<__LINE__<<": "<<#__VA_ARGS__<<": ", _do(__VA_ARGS__)
template<typename T> void _do(T && x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T && x, S&&...y){cerr<<x<<", "; _do(y...);}
#define IOS()
#else
#define IOS() ios::sync_with_stdio(0),cin.tie(0)
#define endl '\n'
#define bug(...)
#endif // BALBIT

const int maxn = 3e5+5;

static int B[1400];
static bool done[1400];

struct Gp{
    int l, r;
    vector<int> nd;
};

int ask(int a, int b, int x[]) {
    return Ask(min(a,b), max(a,b), x);
}

void answer(int a, int b){
    Answer(min(a,b), max(a,b));
}

vector<int> go(vector<int> v) {
    int x = v[rand() % SZ(v)];
    fill(B, B+1400, 1); B[x] = 0;
    vector<int> le, ri;
    for (int y : v) {
        if (y!=x){
            if (ask(0,y,B)) le.pb(y);
            else ri.pb(y);
        }
    }
    vector<int> L = go(le), R = go(ri);
    L.pb(x); L.insert(L.end(), ALL(R));
    return L;
}

void Detect(int T, int n) {
	srand(10298432);
    vector<int> order;
    for (int i = 1; i<n-1; ++i) order.pb(i);
    vector<int> res = go(order);
    for (int i=0;i<SZ(res); ++i) {
        if (i==0) answer(0, res[i]);
        else answer(res[i-1], res[i]);
    }
    answer(res.back(), n-1);
}


#ifdef BALBIT
signed main(){
    bug(1,2,3);
}
#endif

Compilation message

park.cpp:29:13: warning: 'done' defined but not used [-Wunused-variable]
 static bool done[1400];
             ^~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 512 KB Execution killed with signal 8 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 14 ms 768 KB Execution killed with signal 8 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 768 ms 888 KB Wrong Answer[5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 286 ms 1016 KB Execution killed with signal 8 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 939 ms 1016 KB Wrong Answer[5]
2 Halted 0 ms 0 KB -