# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
130749 |
2019-07-16T04:33:58 Z |
임유진(#3171) |
Snake (CEOI08_snake) |
C++14 |
|
2 ms |
376 KB |
#include <stdio.h>
#include <algorithm>
using namespace std;
#include "snakelib.h"
int main() {
const int hd = 12122;
int K = get_speed();
char A1, A2;
int as = 0, ae = hd - K, bs = K, be = hd, ls = 1, le = hd;
while(le - ls > 2 * K) {
if(ae < bs) {
int am = (as + ae) / 2, bm = (bs + be) / 2;
ask_snake(am, bm, &A1, &A2);
if(A1 == 's') ae = am;
else as = am + 1;
if(A2 == 's') bs = bm + 1;
else be = bm;
}
else {
int am = (2 * as + be) / 3, bm = (as + 2 * be) / 3;
ask_snake(am, bm, &A1, &A2);
if(A1 == 'f') {
be = min(be, am);
ae = min(ae, be - 1);
}
else if(A1 == 'b' && A2 == 'f') {
as = max(as, am + 1);
be = min(be, bm);
ae = min(ae, be - 1);
bs = max(bs, as + 1);
}
else if(A2 == 'b') {
as = max(as, bm + 1);
bs = max(bs, as + 1);
}
else {
if(A1 == 's') {
ae = min(ae, am);
bs = max(bs, am + 1);
}
if(A2 == 's') {
ae = min(ae, bm);
bs = max(bs, bm + 1);
}
}
ls = max(ls, bs - ae);
le = min(le, be - as);
ae += K;
be += K;
}
}
tell_length((ls + le) / 2);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
248 KB |
too many calls of ask_snake |
2 |
Incorrect |
2 ms |
376 KB |
too many calls of ask_snake |
3 |
Incorrect |
2 ms |
376 KB |
too many calls of ask_snake |
4 |
Incorrect |
2 ms |
376 KB |
too many calls of ask_snake |
5 |
Incorrect |
2 ms |
248 KB |
too many calls of ask_snake |
6 |
Incorrect |
2 ms |
248 KB |
too many calls of ask_snake |
7 |
Incorrect |
2 ms |
376 KB |
too many calls of ask_snake |
8 |
Incorrect |
2 ms |
248 KB |
too many calls of ask_snake |
9 |
Correct |
2 ms |
376 KB |
Output is correct: estimate ok. 13 calls needed |
10 |
Correct |
2 ms |
248 KB |
Output is correct: estimate ok. 10 calls needed |
11 |
Correct |
2 ms |
252 KB |
Output is correct: estimate ok. 9 calls needed |
12 |
Incorrect |
2 ms |
376 KB |
too many calls of ask_snake |
13 |
Correct |
2 ms |
376 KB |
Output is correct: estimate ok. 9 calls needed |
14 |
Incorrect |
2 ms |
248 KB |
too many calls of ask_snake |
15 |
Incorrect |
2 ms |
248 KB |
too many calls of ask_snake |
16 |
Incorrect |
2 ms |
376 KB |
too many calls of ask_snake |
17 |
Incorrect |
2 ms |
376 KB |
too many calls of ask_snake |
18 |
Incorrect |
2 ms |
248 KB |
too many calls of ask_snake |
19 |
Incorrect |
2 ms |
376 KB |
too many calls of ask_snake |
20 |
Incorrect |
2 ms |
376 KB |
too many calls of ask_snake |