QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#653205 | #4575. Interactive Treasure Hunt | IllusionaryDominance# | WA | 0ms | 3768kb | C++20 | 1.3kb | 2024-10-18 19:42:37 | 2024-10-18 19:42:39 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int Scan(int r, int c) {
printf("SCAN %d %d\n", r, c);
fflush(stdout);
int x;
scanf("%d", &x);
return x;
}
int Dig(int r, int c) {
printf("Dig %d %d\n", r, c);
fflush(stdout);
int x;
scanf("%d", &x);
return x;
}
int main() {
int T;
scanf("%d", &T);
while (T --) {
int n, m;
scanf("%d%d", &n, &m);
int a1 = Scan(1, m);
int a2 = Scan(1, 1);
assert(~ a1 + a2 & 1);
int x12 = (a1 + a2 >> 1) + 3 - m;
int y12 = (a2 - a1 >> 1) + 1 + m;
assert(x12 > 0 && y12 > 0);
int ymid = y12 + 1 >> 1;
int a3 = Scan(1, ymid);
assert(a3 + 2 - x12 >= 0);
int y22 = a3 + 2 - x12 + y12;
assert(~ y22 & 1);
int y2 = y22 / 2, y1 = y12 - y2;
assert(y1 <= y2);
int xmid = x12 + 1 >> 1;
int a4 = Scan(xmid, 1);
assert(a4 + 2 - y12 >= 0);
int x22 = a4 + 2 - y12 + x12;
assert(~ x22 & 1);
int x2 = x22 / 2, x1 = x12 - x2;
assert(x1 <= x2);
if (Dig(x1, y1)) {
Dig(x2, y2);
}else {
Dig(x1, y2);
Dig(x2, y1);
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3768kb
input:
1 2 3 1 3 1 3
output:
SCAN 1 3 SCAN 1 1 SCAN 1 3 SCAN 1 1 Dig 1 2
result:
wrong answer invalid command :