# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
125351 |
2019-07-05T06:31:04 Z |
임유진(#3061) |
Park (JOI17_park) |
C++14 |
|
332 ms |
632 KB |
#include "park.h"
#include<algorithm>
using namespace std;
static int zero[1400], one[1400];
static int N;
static bool chk[1400];
void answer(int a, int b) {
Answer(min(a, b), max(a, b));
}
int ask(int a, int b, int place[]) {
return Ask(min(a, b), max(a, b), place);
}
int f(int x, int y) {
//printf("f(x = %d, y = %d)\n", x, y);
zero[x] = zero[y] = 1;
int t = ask(x, y, zero);
zero[x] = zero[y] = 0;
if(t == 1) return -1;
int s = 0, e = N - 1;
int cnt = N - 2;
while(cnt > 1) {
int m = s;
while(m == x || m == y) m++;
for(int i = 0; i < cnt / 2 - 1; i++) {
m++;
while(m == x || m == y) m++;
}
//printf("cnt = %d, s = %d, e = %d, m = %d\n", cnt, s, e, m);
for(int i = s; i <= m; i++) if(i != x && i != y) one[i] = 0;
t = ask(x, y, one);
for(int i = s; i <= m; i++) one[i] = 1;
if(t == 0) {
e = m;
cnt /= 2;
}
else {
s = m + 1;
cnt = cnt - cnt / 2;
}
}
while(s == x || s == y) s++;
return s;
}
void solve(int x, int y) {
//printf("solve(x = %d, y = %d)\n", x, y);
if(chk[y]) return;
int z = f(x, y);
//printf("z = %d\n", z);
if(z == -1) {
answer(x, y);
chk[y] = true;
}
else {
solve(x, z);
solve(z, y);
}
}
void Detect(int T, int N) {
if(T != 3 && T != 4) return;
::N = N;
for(int i = 0; i < N; i++) one[i] = 1;
for(int i = 1; i < N; i++) solve(0, i);
}
Compilation message
park.cpp: In function 'int f(int, int)':
park.cpp:25:13: warning: variable 'e' set but not used [-Wunused-but-set-variable]
int s = 0, e = N - 1;
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
380 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
250 ms |
472 KB |
Output is correct |
2 |
Correct |
289 ms |
460 KB |
Output is correct |
3 |
Correct |
270 ms |
460 KB |
Output is correct |
4 |
Correct |
332 ms |
476 KB |
Output is correct |
5 |
Correct |
272 ms |
540 KB |
Output is correct |
6 |
Correct |
270 ms |
476 KB |
Output is correct |
7 |
Correct |
290 ms |
504 KB |
Output is correct |
8 |
Correct |
301 ms |
484 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
120 ms |
428 KB |
Output is correct |
2 |
Correct |
330 ms |
468 KB |
Output is correct |
3 |
Correct |
300 ms |
376 KB |
Output is correct |
4 |
Correct |
221 ms |
376 KB |
Output is correct |
5 |
Correct |
221 ms |
632 KB |
Output is correct |
6 |
Correct |
172 ms |
504 KB |
Output is correct |
7 |
Correct |
121 ms |
484 KB |
Output is correct |
8 |
Correct |
269 ms |
376 KB |
Output is correct |
9 |
Correct |
198 ms |
476 KB |
Output is correct |
10 |
Correct |
260 ms |
504 KB |
Output is correct |
11 |
Correct |
206 ms |
376 KB |
Output is correct |
12 |
Correct |
256 ms |
376 KB |
Output is correct |
13 |
Correct |
166 ms |
504 KB |
Output is correct |
14 |
Incorrect |
261 ms |
504 KB |
Wrong Answer[5] |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
376 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |