Submission #126175

#TimeUsernameProblemLanguageResultExecution timeMemory
126175briansuPark (JOI17_park)C++14
0 / 100
365 ms872 KiB
#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; ll t = v[rng() % SZ(v)]; debug(t); for(ll x:v)debug(x); vector<ll> sp; for(ll k:v)if(k != t && ask_edge(t, k))sp.pb(k); for(ll k:sp)debug(k); for(ll k:sp) { Add(k, t); vector<ll> tmp; tmp.pb(k); for(ll x:v)if(x != k && x != t && ask_split(k, x, t))tmp.pb(x); go(tmp); } } void Detect(int T, int N) { rng = mt19937(chrono::system_clock::now().time_since_epoch().count()); n = N; vector<ll> v; REP(i, n)v.pb(i); go(v); }

Compilation message (stderr)

park.cpp: In function 'void go(std::vector<long long int>)':
park.cpp:64:9: warning: unused variable 'x' [-Wunused-variable]
  for(ll x:v)debug(x);
         ^
park.cpp:67:9: warning: unused variable 'k' [-Wunused-variable]
  for(ll k:sp)debug(k);
         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...