# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
225926 |
2020-04-22T03:37:28 Z |
balbit |
Park (JOI17_park) |
C++14 |
|
2000 ms |
384 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));
}
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]) {
B[i] = 1;
int x = ask (0, i, B);
B[i] = 0;
if (x) {
newl.pb(i);
}
}
}
if (!SZ(newl)) while(1);
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) {
B[pt] = 1;
if (ask(0,pt,B)) {
tol.pb(pt);
}else{
tor.pb(pt);
}
B[pt] = 0;
}
v.push({g.l, mid, tol});
v.push({mid+1, g.r, tor});
}
}
for (int x : newl) B[x] = done[x] = 1;
lay = newl;
}
}
#ifdef BALBIT
signed main(){
bug(1,2,3);
}
#endif
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2089 ms |
384 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
43 ms |
384 KB |
Wrong Answer[5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2082 ms |
384 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2088 ms |
384 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2088 ms |
384 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |