Submission #130744

# Submission time Handle Problem Language Result Execution time Memory
130744 2019-07-16T04:29:08 Z 김세빈(#3168) Snake (CEOI08_snake) C++14
35 / 100
2 ms 376 KB
#include <bits/stdc++.h>

#include "snakelib.h"

using namespace std;

int main()
{
	int i, k, s1, s2, e1, e2, m1, m2;
	char a1, a2;
	
	k = get_speed();
	
	s1 = 0; e1 = 12121;
	s2 = 0; e2 = 12121;
	
	for(i=0; i<22; i++){
		e1 = min(12121, e1 + k);
		e2 = min(12121, e2 + k);
		
		m1 = s1 + e1 >> 1;
		m2 = s2 + e2 >> 1;
		
		ask_snake(m1, m2, &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);
}

Compilation message

snake.cpp: In function 'int main()':
snake.cpp:21:11: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   m1 = s1 + e1 >> 1;
        ~~~^~~~
snake.cpp:22:11: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   m2 = s2 + e2 >> 1;
        ~~~^~~~
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 248 KB Output is partially correct: estimate ok. 22 calls needed
2 Partially correct 2 ms 376 KB Output is partially correct: estimate ok. 22 calls needed
3 Partially correct 2 ms 248 KB Output is partially correct: estimate ok. 22 calls needed
4 Partially correct 2 ms 248 KB Output is partially correct: estimate ok. 22 calls needed
5 Partially correct 2 ms 248 KB Output is partially correct: estimate ok. 22 calls needed
6 Partially correct 2 ms 248 KB Output is partially correct: estimate ok. 22 calls needed
7 Incorrect 2 ms 376 KB your estimate differs too much (2 units)
8 Incorrect 2 ms 296 KB your estimate differs too much (3 units)
9 Incorrect 2 ms 376 KB your estimate differs too much (4 units)
10 Incorrect 2 ms 376 KB your estimate differs too much (5 units)
11 Incorrect 2 ms 248 KB your estimate differs too much (6 units)
12 Partially correct 2 ms 376 KB Output is partially correct: estimate ok. 22 calls needed
13 Incorrect 2 ms 248 KB your estimate differs too much (7 units)
14 Partially correct 2 ms 376 KB Output is partially correct: estimate ok. 22 calls needed
15 Partially correct 2 ms 376 KB Output is partially correct: estimate ok. 22 calls needed
16 Partially correct 2 ms 252 KB Output is partially correct: estimate ok. 22 calls needed
17 Partially correct 2 ms 376 KB Output is partially correct: estimate ok. 22 calls needed
18 Partially correct 2 ms 296 KB Output is partially correct: estimate ok. 22 calls needed
19 Partially correct 2 ms 248 KB Output is partially correct: estimate ok. 22 calls needed
20 Partially correct 2 ms 248 KB Output is partially correct: estimate ok. 22 calls needed