답안 #226478

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
226478 2020-04-23T23:14:51 Z Kenzo_1114 Islands (IOI08_islands) C++17
0 / 100
5 ms 384 KB
#include<bits/stdc++.h>
using namespace std;

long long int n, xo, yo;
char ASK[10];

bool ask(long long int x, long long int y)
{
	printf("examine %lld %lld\n", x, y);
	fflush(stdout);
	scanf(" %s", ASK);
	if(ASK[0] == 't')		return true;
	else					return false;
}

void bb(int dx, int dy)
{
	long long int bg = 0, ed = n;
	while(bg < ed)
	{
		long long int mid = (bg == ed - 1) ? ed : (bg + ed) >> 1;	

		long long int nx = xo + dx * mid, ny = yo + dy * mid;
		if(1 > nx || nx > n || 1 > ny || ny > n)	ed = mid - 1;
		else if(ask(nx, ny))	bg = mid;
		else					ed = mid - 1; 
	}

	xo += dx * bg, yo += dy * bg; 
}

int main ()
{
	scanf("%lld %lld %lld", &n, &xo, &yo);

	bb(1, 0);
	bb(0, 1);
	bb(1, 1);
	long long int x = xo, y = yo;
	bb(-1, -1);
	xo = x, y = yo;
	bb(-1, 1);
	x = xo, y = yo;
	bb(1, -1);

	printf("solution %lld %lld\n", (x + xo) / 2, (y + yo) / 2);
	fflush(stdout);
}

Compilation message

islands.cpp: In function 'bool ask(long long int, long long int)':
islands.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf(" %s", ASK);
  ~~~~~^~~~~~~~~~~~
islands.cpp: In function 'int main()':
islands.cpp:34:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld %lld %lld", &n, &xo, &yo);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Incorrect 5 ms 384 KB Output isn't correct
3 Incorrect 4 ms 256 KB Output isn't correct
4 Incorrect 5 ms 256 KB Output isn't correct
5 Incorrect 4 ms 256 KB Output isn't correct
6 Incorrect 5 ms 384 KB Output isn't correct
7 Incorrect 4 ms 256 KB Output isn't correct
8 Incorrect 5 ms 256 KB Output isn't correct
9 Incorrect 5 ms 384 KB Output isn't correct
10 Incorrect 5 ms 384 KB Output isn't correct
11 Incorrect 5 ms 256 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 308 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -