Submission #54312

# Submission time Handle Problem Language Result Execution time Memory
54312 2018-07-03T06:47:48 Z 창조론자(#2048) Aliens (IOI07_aliens) C++11
0 / 100
1000 ms 476 KB
#include<stdio.h>
#include<string.h>
long long min(long long a, long long b) { if (a < b)return a; return b; }
char X[10];
bool qr(long long x, long long y) {
	printf("examine %lld %lld\n", x, y);
	fflush(stdout);
	scanf("%s", X);
	if (X[0] == 't'&&X[1] == 'r'&&X[2] == 'u'&&X[3] == 'e')return 1;
	return 0;
}
long long ansx, ansy;
void sol(long long x, long long y) {
	printf("solution %lld %lld\n", x, y);
	fflush(stdout);
}
int main() {
	long long i, j, bef, n, sx, sy; scanf("%lld%lld%lld",&n, &sx, &sy);
	long long mx = min(n - sx + 1, n - sy + 1) / 5, cnt = 0;
	bef = sx + mx * 5 - 1;
	while (!qr(sx + 5 * mx - 1, sy)) {
		bef = sx + mx * 5 - 1;
		mx = (mx * 4 + 1) / 5;
	}
	long long s = sx + mx * 5 - 1, e = bef, res;
	while (s <= e) {
		long long m = (s + e) / 2;
		if (qr(m, sy)) res = m, s = m + 1;
		else e = m - 1;
	}
	long long m = (res + 1 - sx) / 5;
	sol((2 * sx + 5 * m - 1) / 2, (2 * sy + 5 * m - 1) / 2);
	return 0;
}

Compilation message

aliens.cpp: In function 'int main()':
aliens.cpp:18:12: warning: unused variable 'i' [-Wunused-variable]
  long long i, j, bef, n, sx, sy; scanf("%lld%lld%lld",&n, &sx, &sy);
            ^
aliens.cpp:18:15: warning: unused variable 'j' [-Wunused-variable]
  long long i, j, bef, n, sx, sy; scanf("%lld%lld%lld",&n, &sx, &sy);
               ^
aliens.cpp:19:50: warning: unused variable 'cnt' [-Wunused-variable]
  long long mx = min(n - sx + 1, n - sy + 1) / 5, cnt = 0;
                                                  ^~~
aliens.cpp: In function 'bool qr(long long int, long long int)':
aliens.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s", X);
  ~~~~~^~~~~~~~~
aliens.cpp: In function 'int main()':
aliens.cpp:18:39: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  long long i, j, bef, n, sx, sy; scanf("%lld%lld%lld",&n, &sx, &sy);
                                  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aliens.cpp:31:21: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
  long long m = (res + 1 - sx) / 5;
                 ~~~~^~~
# Verdict Execution time Memory Grader output
1 Execution timed out 1063 ms 248 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 436 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 436 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1044 ms 436 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 476 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 476 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 476 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 476 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 476 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 476 KB Incorrect
2 Halted 0 ms 0 KB -