# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
683976 |
2023-01-19T20:39:18 Z |
rainboy |
Park (JOI17_park) |
C++17 |
|
321 ms |
540 KB |
#include "park.h"
#include <string.h>
const int N = 1400;
int t, n;
int query(int *used, int a, int b) {
int tmp;
if (a > b)
tmp = a, a = b, b = tmp;
return Ask(a, b, used);
}
void answer(int a, int b) {
int tmp;
if (a > b)
tmp = a, a = b, b = tmp;
Answer(a, b);
}
void Detect(int t_, int n_) {
t = t_, n = n_;
if (t == 1) {
static int used[N];
for (int i = 0; i < n; i++)
for (int j = i + 1; j < n; j++) {
for (int k = 0; k < n; k++)
used[k] = k == i || k == j ? 1 : 0;
if (query(used, i, j))
answer(i, j);
}
} else if (t <= 4) {
static int ii[N], used[N];
for (int j = 0; j < n; j++) {
int lower = 0, upper = j;
while (upper - lower > 1) {
int h = (lower + upper) / 2;
for (int i = 0; i < n; i++)
used[i] = 1;
for (int h_ = h; h_ < j; h_++)
used[ii[h_]] = 0;
if (query(used, 0, j))
upper = h;
else
lower = h;
}
for (int h = j; h > upper; h--)
ii[h] = ii[h - 1];
ii[upper] = j;
}
for (int h = 1; h < n; h++) {
int lower = -1, upper = h - 1;
while (upper - lower > 1) {
int g = (lower + upper) / 2;
for (int i = 0; i < n; i++)
used[i] = 0;
for (int f = 0; f <= g; f++)
used[ii[f]] = 1;
used[ii[h]] = 1;
if (query(used, 0, ii[h]))
upper = g;
else
lower = g;
}
answer(ii[upper], ii[h]);
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
12 ms |
212 KB |
Output is correct |
3 |
Correct |
13 ms |
340 KB |
Output is correct |
4 |
Correct |
12 ms |
212 KB |
Output is correct |
5 |
Correct |
13 ms |
324 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
321 ms |
432 KB |
Output is correct |
2 |
Correct |
155 ms |
404 KB |
Output is correct |
3 |
Correct |
158 ms |
420 KB |
Output is correct |
4 |
Correct |
314 ms |
540 KB |
Output is correct |
5 |
Correct |
304 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
233 ms |
368 KB |
Output is correct |
2 |
Correct |
254 ms |
384 KB |
Output is correct |
3 |
Correct |
265 ms |
388 KB |
Output is correct |
4 |
Correct |
253 ms |
384 KB |
Output is correct |
5 |
Correct |
268 ms |
376 KB |
Output is correct |
6 |
Correct |
254 ms |
384 KB |
Output is correct |
7 |
Correct |
251 ms |
384 KB |
Output is correct |
8 |
Correct |
250 ms |
392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
115 ms |
344 KB |
Output is correct |
2 |
Correct |
310 ms |
380 KB |
Output is correct |
3 |
Correct |
293 ms |
392 KB |
Output is correct |
4 |
Correct |
288 ms |
380 KB |
Output is correct |
5 |
Correct |
287 ms |
400 KB |
Output is correct |
6 |
Correct |
291 ms |
436 KB |
Output is correct |
7 |
Correct |
285 ms |
468 KB |
Output is correct |
8 |
Correct |
275 ms |
380 KB |
Output is correct |
9 |
Correct |
274 ms |
388 KB |
Output is correct |
10 |
Correct |
284 ms |
420 KB |
Output is correct |
11 |
Correct |
291 ms |
464 KB |
Output is correct |
12 |
Correct |
269 ms |
392 KB |
Output is correct |
13 |
Correct |
285 ms |
300 KB |
Output is correct |
14 |
Correct |
273 ms |
340 KB |
Output is correct |
15 |
Correct |
289 ms |
340 KB |
Output is correct |
16 |
Correct |
279 ms |
300 KB |
Output is correct |
17 |
Correct |
307 ms |
444 KB |
Output is correct |
18 |
Correct |
295 ms |
340 KB |
Output is correct |
19 |
Correct |
302 ms |
508 KB |
Output is correct |
20 |
Correct |
290 ms |
380 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |