# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
130782 |
2019-07-16T05:15:22 Z |
김세빈(#3168) |
Snake (CEOI08_snake) |
C++14 |
|
2 ms |
380 KB |
#include <bits/stdc++.h>
#include "snakelib.h"
using namespace std;
int main()
{
int i, k, d, s1, s2, e1, e2, m1, m2;
char a1, a2;
k = get_speed();
if(k == 0) k = 1, d = 0;
else d = 1;
if(k > 1) return 0;
s1 = 0; e1 = 12121 / k;
s2 = 0; e2 = 12121 / k;
for(i=0; i<13; i++){
e1 = min(12121 / k, e1 + d);
e2 = min(12121 / k, e2 + d);
if(s1 == s2 && e1 == e2 && e1 - s1 >= 3){
m1 = (s1 * 2 + e1) / 3;
m2 = (s1 + e1 * 2) / 3;
ask_snake(m1 * k, m2 * k, &a1, &a2);
if(a1 == 'b' && a2 == 'f'){
s1 = s2 = m1 + 1;
e1 = e2 = m2 - 1;
}
else if(a1 == 'f') e1 = e2 = m1 - 1;
else if(a2 == 'b') s1 = s2 = m2 + 1;
else{
if(a1 == 's') e1 = m1;
else s1 = m1 + 1, e1 = m2;
if(a2 == 's') s2 = m2;
else s2 = m1, e2 = m2 - 1;
}
}
else{
m1 = s1 + e1 >> 1;
m2 = s2 + e2 >> 1;
ask_snake(m1 * k, m2 * k, &a1, &a2);
if(a1 == 'b') s1 = m1 + 1;
else e1 = m1 - 1;
if(a2 == 'f') e2 = m2 - 1;
else s2 = m2 + 1;
}
}
tell_length((s2 - e1 - 1) * k);
}
Compilation message
snake.cpp: In function 'int main()':
snake.cpp:46:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
m1 = s1 + e1 >> 1;
~~~^~~~
snake.cpp:47:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
m2 = s2 + e2 >> 1;
~~~^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct: estimate ok. 13 calls needed |
2 |
Incorrect |
2 ms |
248 KB |
Unexpected end of file - token expected |
3 |
Incorrect |
2 ms |
376 KB |
Unexpected end of file - token expected |
4 |
Incorrect |
2 ms |
248 KB |
Unexpected end of file - token expected |
5 |
Incorrect |
2 ms |
248 KB |
Unexpected end of file - token expected |
6 |
Correct |
2 ms |
380 KB |
Output is correct: estimate ok. 13 calls needed |
7 |
Incorrect |
2 ms |
248 KB |
your estimate differs too much (2 units) |
8 |
Incorrect |
2 ms |
376 KB |
Unexpected end of file - token expected |
9 |
Incorrect |
2 ms |
376 KB |
Unexpected end of file - token expected |
10 |
Incorrect |
2 ms |
376 KB |
Unexpected end of file - token expected |
11 |
Incorrect |
2 ms |
376 KB |
Unexpected end of file - token expected |
12 |
Correct |
2 ms |
248 KB |
Output is correct: estimate ok. 13 calls needed |
13 |
Incorrect |
2 ms |
248 KB |
Unexpected end of file - token expected |
14 |
Correct |
2 ms |
376 KB |
Output is correct: estimate ok. 13 calls needed |
15 |
Incorrect |
2 ms |
248 KB |
Unexpected end of file - token expected |
16 |
Correct |
2 ms |
248 KB |
Output is correct: estimate ok. 13 calls needed |
17 |
Incorrect |
2 ms |
248 KB |
your estimate differs too much (2 units) |
18 |
Incorrect |
2 ms |
248 KB |
Unexpected end of file - token expected |
19 |
Incorrect |
2 ms |
248 KB |
Unexpected end of file - token expected |
20 |
Incorrect |
2 ms |
376 KB |
Unexpected end of file - token expected |