QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#511443 | #5206. Hot and Cold | zhangboju | WA | 1ms | 3508kb | C++17 | 890b | 2024-08-09 21:46:22 | 2024-08-09 21:46:23 |
Judging History
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);
}
Details
Tip: Click on the bar to expand more detailed information
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