# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
130808 |
2019-07-16T06:08:07 Z |
구재현(#3176) |
Snake (CEOI08_snake) |
C++14 |
|
2 ms |
376 KB |
#include <bits/stdc++.h>
#include "snakelib.h"
using namespace std;
char a1, a2;
int main(){
int k = get_speed();
ask_snake(4040, 8080, &a1, &a2);
int sl, el, sr, er;
if(a1 == 'f'){
tie(sl, el, sr, er) = make_tuple(0, 4040, 0, 4040);
}
else if(a1 == 's'){
tie(sl, el) = make_tuple(0, 4040);
if(a2 == 's') tie(sr, er) = make_tuple(8080, 12121);
else tie(sr, er) = make_tuple(4040, 8080);
}
else{
if(a2 == 'f') tie(sl, el, sr, er) = make_tuple(4040, 8080, 4040, 8080);
else if(a2 == 's') tie(sl, el, sr, er) = make_tuple(4040, 8080, 8080, 12121);
else tie(sl, el, sr, er) = make_tuple(8080, 12121, 8080, 12121);
}
for(int i=0; (er - sr > k || el - sl > k); i++){
el += k;
er += k;
int ml = (sl + el) / 2;
int mr = (sr + er) / 2;
ask_snake(ml, mr, &a1, &a2);
if(a1 == 'b') sl = ml + 1;
else el = ml;
if(a2 == 'f') er = mr;
else sr = mr + 1;
}
int est1 = (er - el);
int est2 = (sr - sl);
tell_length(max(1, (est1 + est2) / 2));
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct: estimate ok. 13 calls needed |
2 |
Correct |
2 ms |
248 KB |
Output is correct: estimate ok. 13 calls needed |
3 |
Correct |
2 ms |
252 KB |
Output is correct: estimate ok. 13 calls needed |
4 |
Correct |
2 ms |
296 KB |
Output is correct: estimate ok. 13 calls needed |
5 |
Correct |
2 ms |
248 KB |
Output is correct: estimate ok. 13 calls needed |
6 |
Correct |
2 ms |
376 KB |
Output is correct: estimate ok. 13 calls needed |
7 |
Correct |
2 ms |
376 KB |
Output is correct: estimate ok. 13 calls needed |
8 |
Correct |
2 ms |
248 KB |
Output is correct: estimate ok. 13 calls needed |
9 |
Correct |
2 ms |
248 KB |
Output is correct: estimate ok. 13 calls needed |
10 |
Correct |
2 ms |
248 KB |
Output is correct: estimate ok. 13 calls needed |
11 |
Correct |
2 ms |
248 KB |
Output is correct: estimate ok. 13 calls needed |
12 |
Correct |
2 ms |
248 KB |
Output is correct: estimate ok. 13 calls needed |
13 |
Correct |
2 ms |
248 KB |
Output is correct: estimate ok. 13 calls needed |
14 |
Correct |
2 ms |
376 KB |
Output is correct: estimate ok. 13 calls needed |
15 |
Correct |
2 ms |
252 KB |
Output is correct: estimate ok. 13 calls needed |
16 |
Correct |
2 ms |
248 KB |
Output is correct: estimate ok. 13 calls needed |
17 |
Correct |
2 ms |
300 KB |
Output is correct: estimate ok. 13 calls needed |
18 |
Correct |
2 ms |
376 KB |
Output is correct: estimate ok. 13 calls needed |
19 |
Correct |
2 ms |
248 KB |
Output is correct: estimate ok. 13 calls needed |
20 |
Correct |
2 ms |
376 KB |
Output is correct: estimate ok. 13 calls needed |