제출 #225923

#제출 시각아이디문제언어결과실행 시간메모리
225923balbitPark (JOI17_park)C++14
0 / 100
5 ms384 KiB
#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)); } void Detect(int T, int n) { int over = 1; vector<int> lay = {0}; done[0] = 1; B[0] = 1; while (over != n) { vector<int> newl; for (int i = 0; i<n; ++i) { if (!done[i]) { int x = ask (0, i, B); if (x) { newl.pb(i); } } } queue<Gp> v; // int st = 0; v.push({0,SZ(lay)-1,newl}); while (!v.empty()) { Gp g = v.front(); v.pop(); if (g.l == g.r) { for (int pt : g.nd) { answer(lay[g.l], pt); over++; } }else{ int mid = (g.l + g.r) / 2; for (int i = 0; i<SZ(lay); ++i) { if (i >= g.l && i <= mid) { B[lay[i]] = 1; }else{ B[lay[i]] = 0; } } vector<int> tol, tor; for (int pt : g.nd) { if (ask(0,pt,B)) { tol.pb(pt); }else{ tor.pb(pt); } } v.push({g.l, mid, tol}); v.push({mid+1, g.r, tor}); } } for (int x : newl) B[x] = 1; lay = newl; } } #ifdef BALBIT signed main(){ bug(1,2,3); } #endif
#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...