Submission #225957

# Submission time Handle Problem Language Result Execution time Memory
225957 2020-04-22T05:16:34 Z balbit Park (JOI17_park) C++14
10 / 100
952 ms 1140 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) {
    if (SZ(v) <= 1) return 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];
             ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Wrong Answer[2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 253 ms 504 KB Output is correct
2 Correct 111 ms 512 KB Output is correct
3 Correct 106 ms 760 KB Output is correct
4 Correct 197 ms 512 KB Output is correct
5 Correct 212 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 834 ms 1140 KB Wrong Answer[5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 564 ms 864 KB Wrong Answer[5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 952 ms 912 KB Wrong Answer[5]
2 Halted 0 ms 0 KB -