Submission #130742

# Submission time Handle Problem Language Result Execution time Memory
130742 2019-07-16T04:28:07 Z 김세빈(#3168) Snake (CEOI08_snake) C++14
0 / 100
2 ms 404 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;
		
		printf("%d %d %d %d\n", s1, e1, s2, e2);
	}
	
	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 Incorrect 2 ms 296 KB invalid interaction
2 Incorrect 2 ms 376 KB invalid interaction
3 Incorrect 2 ms 248 KB invalid interaction
4 Incorrect 2 ms 376 KB invalid interaction
5 Incorrect 2 ms 248 KB invalid interaction
6 Incorrect 2 ms 248 KB invalid interaction
7 Incorrect 2 ms 248 KB invalid interaction
8 Incorrect 2 ms 404 KB invalid interaction
9 Incorrect 2 ms 248 KB invalid interaction
10 Incorrect 2 ms 376 KB invalid interaction
11 Incorrect 2 ms 248 KB invalid interaction
12 Incorrect 2 ms 376 KB invalid interaction
13 Incorrect 2 ms 404 KB invalid interaction
14 Incorrect 2 ms 376 KB invalid interaction
15 Incorrect 2 ms 252 KB invalid interaction
16 Incorrect 2 ms 376 KB invalid interaction
17 Incorrect 2 ms 248 KB invalid interaction
18 Incorrect 2 ms 248 KB invalid interaction
19 Incorrect 2 ms 248 KB invalid interaction
20 Incorrect 2 ms 376 KB invalid interaction