QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#511443#5206. Hot and ColdzhangbojuWA 1ms3508kbC++17890b2024-08-09 21:46:222024-08-09 21:46:23

Judging History

你现在查看的是最新测评结果

  • [2024-08-09 21:46:23]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3508kb
  • [2024-08-09 21:46:22]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int lim = 1e6;
string close;
string ask(int x, int y) {
	if (x < 0) x = 0;
	if (x > lim) x = lim;
	if (y < 0) y = 0;
	if (y > lim) y = lim;

	cout << x << " " << y << endl;
	string s;
	getline(cin, s);
	if (s.back() != '!') exit(0);
	return s; 
}
int main() {
	ask(0, 0);
	string s1 = ask(0, 0);
	string s2 = ask(1, 1);
	if (s1 == s2) {
		for (int i : {0, 1, 2})
			for (int j : {0, 1, 2})
				ask(i, j);
		return 0;
	}
	close = s1;
	int xl = 0, xr = lim, yl = 0, yr = lim;
	for (int t = 0; t < 20; t++) {
		if (xl == xr && yl == yr)
			break;
		int xmid = (xl + xr) >> 1;
		int ymid = (yl + yr) >> 1;
		ask(xmid, ymid);
		if (ask(xmid + 1, ymid) == close) 
			xl = xmid + 1;
		else xr = xmid - 1;
		if (ask(xmid + 1, ymid + 1) == close)
			yl = ymid + 1;
		else yr = ymid - 1;
	}
	ask(xl, yl);
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3508kb

input:

Tabilmadi

output:

0 0

result:

wrong answer format  Unexpected end of file - int32 expected