# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
126185 |
2019-07-07T08:28:42 Z |
briansu |
Park (JOI17_park) |
C++14 |
|
773 ms |
1316 KB |
#include "park.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;
#define REP(i, n) for(int i = 0;i < n;i ++)
#define REP1(i, n) for(int i = 1;i <= n;i ++)
#define FILL(i, n) memset(i, n, sizeof(i))
#define X first
#define Y second
#define pb push_back
#define SZ(_a) ((int)(_a).size())
#define ALL(_a) (_a).begin(), (_a).end()
#ifdef brian
template<typename T>void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...t>void _do(T &&x, t &&...X){cerr<<x<<", ";_do(X...);}
#define debug(...) {\
fprintf(stderr, "%s - %d (%s) = ", __PRETTY_FUNCTION__, __LINE__, #__VA_ARGS__);\
_do(__VA_ARGS__);\
}
#define IOS()
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define debug(...)
#define endl '\n'
#endif
const ll MAXn = 2e3 + 5;
const ll INF = ll(1e17);
const ll MOD = 1000000007;
static void Add(ll a, ll b)
{
if(a > b)swap(a, b);
debug(a, b);
Answer(a, b);
}
static mt19937 rng;
static ll n;
static bool ask_edge(ll a,ll b)
{
int tmp[n];
REP(i, n)tmp[i] = (i == a || i == b);
if(a > b)swap(a, b);
return Ask(a, b, tmp);
}
static bool ask_split(ll a,ll b,ll c)// does a split path between b and c
{
int tmp[n];
REP(i, n)tmp[i] = (i != a);
if(b > c)swap(c, b);
return !Ask(b, c, tmp);
}
static void go(vector<ll> v)
{
if(SZ(v) <= 1)return;
random_shuffle(ALL(v));
ll t = v[0];
ll p;
for(int i = 1;i < SZ(v);i ++)if(ask_edge(v[i], t))
{
p = v[i];
break;
}
Add(t, p);
vector<ll> a, b;
a.pb(p), b.pb(t);
for(int i = 1;i < SZ(v);i ++)if(v[i] != p)
{
if(ask_split(p, t, v[i]))a.pb(v[i]);
else b.pb(v[i]);
}
go(a);
go(b);
}
void Detect(int T, int N) {
rng = mt19937(chrono::system_clock::now().time_since_epoch().count());
srand(chrono::system_clock::now().time_since_epoch().count());
n = N;
vector<ll> v;
REP(i, n)v.pb(i);
go(v);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
227 ms |
640 KB |
Output is correct |
2 |
Correct |
167 ms |
632 KB |
Output is correct |
3 |
Correct |
158 ms |
624 KB |
Output is correct |
4 |
Correct |
245 ms |
680 KB |
Output is correct |
5 |
Correct |
201 ms |
632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
328 ms |
1260 KB |
Wrong Answer[5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
250 ms |
1056 KB |
Wrong Answer[5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
773 ms |
1316 KB |
Wrong Answer[5] |
2 |
Halted |
0 ms |
0 KB |
- |