# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
282472 |
2020-08-24T12:55:52 Z |
rama_pang |
Park (JOI17_park) |
C++14 |
|
31 ms |
512 KB |
#include "park.h"
#include <bits/stdc++.h>
using namespace std;
static int Place[1400];
void Detect(int T, int N) {
if (T == 1) {
for (int i = 0; i < N; i++) {
for (int j = i + 1; j < N; j++) {
Place[i] = 1;
Place[j] = 1;
if (Ask(i, j, Place)) {
Answer(i, j);
}
Place[i] = 0;
Place[j] = 0;
}
}
} else if (T == 2) {
mt19937 rnd(12345);
function<void(int, int, vector<int>)> Solve = [&](int l, int r, vector<int> cand) {
if (cand.empty()) {
return Answer(min(l, r), max(l, r));
}
memset(Place, 0, sizeof(Place));
int m = cand[rnd() % cand.size()];
for (auto i : cand) {
Place[i] = 1;
}
Place[l] = Place[r] = 1;
vector<int> lf, rg;
for (auto i : cand) if (i != m) {
Place[i] = 0;
if (Ask(l, m, Place)) {
rg.emplace_back(i);
} else {
lf.emplace_back(i);
}
Place[i] = 1;
}
Solve(m, r, rg);
Solve(l, m, lf);
};
vector<int> cand;
for (int i = 1; i + 1 < N; i++) {
cand.emplace_back(i);
}
Solve(0, N - 1, cand);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
9 ms |
384 KB |
Output is correct |
3 |
Correct |
9 ms |
384 KB |
Output is correct |
4 |
Correct |
9 ms |
384 KB |
Output is correct |
5 |
Correct |
10 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
31 ms |
512 KB |
Wrong Answer[4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |