# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
225929 |
2020-04-22T03:39:05 Z |
balbit |
Park (JOI17_park) |
C++14 |
|
156 ms |
504 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;
for (int x : lay) B[x] = done[x] = 1;
lay = newl;
}
}
#ifdef BALBIT
signed main(){
bug(1,2,3);
}
#endif
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
76 ms |
504 KB |
Wrong Answer[5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
96 ms |
476 KB |
Output is correct |
2 |
Correct |
102 ms |
384 KB |
Output is correct |
3 |
Correct |
104 ms |
480 KB |
Output is correct |
4 |
Correct |
72 ms |
504 KB |
Output is correct |
5 |
Correct |
110 ms |
384 KB |
Output is correct |
6 |
Correct |
94 ms |
504 KB |
Output is correct |
7 |
Correct |
79 ms |
464 KB |
Output is correct |
8 |
Correct |
102 ms |
472 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
80 ms |
448 KB |
Output is correct |
2 |
Incorrect |
107 ms |
384 KB |
Wrong Answer[5] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
156 ms |
384 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |