QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#653218 | #4575. Interactive Treasure Hunt | IllusionaryDominance# | AC ✓ | 6ms | 3876kb | C++20 | 1.3kb | 2024-10-18 19:44:30 | 2024-10-18 19:44:31 |
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;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3828kb
input:
1 2 3 1 3 1 3 1 1
output:
SCAN 1 3 SCAN 1 1 SCAN 1 3 SCAN 1 1 DIG 1 2 DIG 1 3
result:
ok (1 test case)
Test #2:
score: 0
Accepted
time: 6ms
memory: 3876kb
input:
72 3 3 5 1 1 1 1 1 3 3 4 4 4 4 0 1 1 3 3 5 5 5 3 0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IG 1 9 DIG 2 10 SCAN 1 5 SCAN 1 1 SCAN 1 2 SCAN 2 1 DIG 2 1 DIG 2 2 SCAN 1 13 SCAN 1 1 SCAN 1 7 SCAN 2 1 DIG 2 1 DIG 2 13 SCAN 1 15 SCAN 1 ...
result:
ok (100 test cases)
Test #4:
score: 0
Accepted
time: 2ms
memory: 3812kb
input:
100 7 2 4 6 4 4 1 1 10 2 15 17 15 3 1 1 12 2 11 9 9 7 1 1 6 2 11 11 11 1 1 1 14 2 14 16 14 12 1 1 7 2 7 7 7 7 1 1 16 2 19 21 19 9 1 1 13 2 8 8 8 4 1 1 15 2 10 8 8 4 1 1 9 2 6 6 6 6 0 1 1 11 2 13 15 13 3 1 1 13 2 11 13 11 7 1 1 15 2 18 18 18 6 1 1 5 2 7 5 5 1 1 1 8 2 7 7 7 3 0 1 1 11 2 6 8 6 6 1 1 14...
output:
SCAN 1 2 SCAN 1 1 SCAN 1 2 SCAN 3 1 DIG 2 2 DIG 4 2 SCAN 1 2 SCAN 1 1 SCAN 1 2 SCAN 9 1 DIG 8 2 DIG 9 2 SCAN 1 2 SCAN 1 1 SCAN 1 1 SCAN 6 1 DIG 2 1 DIG 9 1 SCAN 1 2 SCAN 1 1 SCAN 1 2 SCAN 6 1 DIG 6 1 DIG 6 2 SCAN 1 2 SCAN 1 1 SCAN 1 2 SCAN 8 1 DIG 3 2 DIG 13 2 SCAN 1 2 SCAN 1 1 SCAN 1 2 SCAN 4 1 DIG...
result:
ok (100 test cases)
Test #5:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
100 3 10 15 11 9 7 1 1 3 12 4 22 4 22 0 1 1 3 13 12 20 8 16 1 1 3 4 6 6 6 4 1 1 3 10 13 9 5 9 0 1 1 3 15 10 20 6 20 1 1 3 13 10 16 4 16 1 1 3 16 23 13 3 11 1 1 3 12 15 7 1 7 1 1 3 8 13 7 3 5 1 1 3 13 13 17 13 15 1 1 3 9 10 10 4 8 1 1 3 9 14 6 4 6 0 1 1 3 11 13 11 11 11 0 1 1 3 4 8 2 2 2 1 1 3 7 7 13...
output:
SCAN 1 10 SCAN 1 1 SCAN 1 5 SCAN 3 1 DIG 3 2 DIG 3 7 SCAN 1 12 SCAN 1 1 SCAN 1 11 SCAN 2 1 DIG 1 10 DIG 1 12 DIG 3 10 SCAN 1 13 SCAN 1 1 SCAN 1 9 SCAN 3 1 DIG 3 7 DIG 3 11 SCAN 1 4 SCAN 1 1 SCAN 1 3 SCAN 3 1 DIG 2 1 DIG 3 4 SCAN 1 10 SCAN 1 1 SCAN 1 5 SCAN 2 1 DIG 1 3 DIG 1 6 DIG 3 3 SCAN 1 15 SCAN ...
result:
ok (100 test cases)
Test #6:
score: 0
Accepted
time: 3ms
memory: 3848kb
input:
100 7 3 14 10 10 2 1 1 5 3 4 6 4 6 0 1 1 5 3 10 6 6 2 1 1 6 3 9 9 9 3 1 1 6 3 3 7 3 7 1 1 10 3 11 11 11 7 1 1 15 3 29 31 29 3 1 1 16 3 10 12 10 12 0 1 1 11 3 9 9 9 7 1 1 15 3 23 27 23 7 1 1 6 3 8 6 6 6 1 1 12 3 14 18 14 12 1 1 4 3 7 3 3 1 1 1 14 3 16 18 16 12 0 1 1 8 3 11 11 9 3 1 1 16 3 13 11 11 3 ...
output:
SCAN 1 3 SCAN 1 1 SCAN 1 1 SCAN 6 1 DIG 5 1 DIG 7 1 SCAN 1 3 SCAN 1 1 SCAN 1 3 SCAN 3 1 DIG 1 2 DIG 1 3 DIG 4 2 SCAN 1 3 SCAN 1 1 SCAN 1 1 SCAN 4 1 DIG 3 1 DIG 5 1 SCAN 1 3 SCAN 1 1 SCAN 1 2 SCAN 5 1 DIG 4 1 DIG 5 3 SCAN 1 3 SCAN 1 1 SCAN 1 3 SCAN 3 1 DIG 1 3 DIG 4 3 SCAN 1 3 SCAN 1 1 SCAN 1 2 SCAN ...
result:
ok (100 test cases)
Test #7:
score: 0
Accepted
time: 2ms
memory: 3768kb
input:
100 10 6 15 15 11 5 1 1 4 8 13 1 1 1 1 1 2 2 1 1 1 1 1 1 15 6 6 10 6 10 0 1 1 7 4 7 3 3 3 1 1 4 4 9 7 7 3 0 1 1 12 10 26 26 20 12 1 1 11 3 10 8 8 8 1 1 6 11 14 16 8 12 0 1 1 3 11 9 17 9 15 0 1 1 7 8 14 12 10 10 1 1 16 12 20 16 12 14 0 1 1 15 11 17 19 9 19 1 1 16 9 20 16 12 6 1 1 4 16 28 6 6 6 1 1 8 ...
output:
SCAN 1 6 SCAN 1 1 SCAN 1 4 SCAN 6 1 DIG 6 3 DIG 6 4 SCAN 1 8 SCAN 1 1 SCAN 1 2 SCAN 1 1 DIG 1 1 DIG 1 2 SCAN 1 2 SCAN 1 1 SCAN 1 2 SCAN 1 1 DIG 1 1 DIG 1 2 SCAN 1 6 SCAN 1 1 SCAN 1 5 SCAN 3 1 DIG 1 3 DIG 1 6 DIG 4 3 SCAN 1 4 SCAN 1 1 SCAN 1 2 SCAN 2 1 DIG 1 1 DIG 3 2 SCAN 1 4 SCAN 1 1 SCAN 1 2 SCAN ...
result:
ok (100 test cases)
Test #8:
score: 0
Accepted
time: 3ms
memory: 3696kb
input:
100 11 15 12 20 10 20 0 1 1 15 11 30 10 10 10 1 1 16 13 17 15 9 13 1 1 11 16 26 30 22 24 1 1 10 12 31 21 17 7 1 1 15 11 33 21 19 15 0 1 1 13 13 31 31 27 15 0 1 1 15 14 33 19 13 11 1 1 14 10 36 34 30 8 1 1 14 15 19 23 13 17 0 1 1 11 13 21 25 17 23 0 1 1 14 15 35 35 31 19 1 1 15 15 27 27 19 23 0 1 1 1...
output:
SCAN 1 15 SCAN 1 1 SCAN 1 10 SCAN 2 1 DIG 1 6 DIG 1 14 DIG 3 6 SCAN 1 11 SCAN 1 1 SCAN 1 1 SCAN 6 1 DIG 1 1 DIG 11 1 SCAN 1 13 SCAN 1 1 SCAN 1 7 SCAN 3 1 DIG 2 4 DIG 4 9 SCAN 1 16 SCAN 1 1 SCAN 1 10 SCAN 8 1 DIG 4 5 DIG 11 14 SCAN 1 12 SCAN 1 1 SCAN 1 4 SCAN 9 1 DIG 8 3 DIG 9 5 SCAN 1 11 SCAN 1 1 SC...
result:
ok (100 test cases)
Test #9:
score: 0
Accepted
time: 3ms
memory: 3780kb
input:
100 16 16 38 34 22 16 1 1 16 16 24 34 22 34 1 1 16 16 22 28 18 28 1 1 16 16 27 17 17 11 1 1 16 16 30 34 26 30 0 1 1 16 16 21 29 19 25 1 1 16 16 28 36 22 24 0 1 1 16 16 15 43 15 35 1 1 16 16 40 36 26 18 0 1 1 16 16 36 38 26 22 1 1 16 16 27 21 13 15 1 1 16 16 32 24 20 14 1 1 16 16 31 41 25 25 0 1 1 16...
output:
SCAN 1 16 SCAN 1 1 SCAN 1 8 SCAN 12 1 DIG 10 7 DIG 13 8 SCAN 1 16 SCAN 1 1 SCAN 1 11 SCAN 8 1 DIG 1 7 DIG 15 15 SCAN 1 16 SCAN 1 1 SCAN 1 10 SCAN 6 1 DIG 1 6 DIG 11 14 SCAN 1 16 SCAN 1 1 SCAN 1 6 SCAN 5 1 DIG 4 1 DIG 5 11 SCAN 1 16 SCAN 1 1 SCAN 1 10 SCAN 10 1 DIG 3 5 DIG 3 14 DIG 16 5 SCAN 1 16 SCA...
result:
ok (100 test cases)
Test #10:
score: 0
Accepted
time: 3ms
memory: 3820kb
input:
100 16 16 23 17 17 13 1 1 16 16 37 25 17 11 0 1 1 16 16 33 45 25 23 0 1 1 16 16 20 44 20 28 0 1 1 16 16 41 33 29 19 1 1 16 16 21 29 17 19 1 1 16 16 37 47 27 23 1 1 16 16 24 18 12 16 0 1 1 16 16 38 36 34 20 1 1 16 16 33 21 17 11 0 1 1 16 16 29 31 19 27 0 1 1 16 16 52 28 28 4 1 1 16 16 29 17 11 17 1 1...
output:
SCAN 1 16 SCAN 1 1 SCAN 1 7 SCAN 4 1 DIG 3 1 DIG 4 13 SCAN 1 16 SCAN 1 1 SCAN 1 6 SCAN 9 1 DIG 8 5 DIG 8 6 DIG 10 5 SCAN 1 16 SCAN 1 1 SCAN 1 12 SCAN 13 1 DIG 12 11 DIG 12 12 DIG 14 11 SCAN 1 16 SCAN 1 1 SCAN 1 15 SCAN 10 1 DIG 9 13 DIG 9 16 DIG 10 13 SCAN 1 16 SCAN 1 1 SCAN 1 7 SCAN 12 1 DIG 8 3 DI...
result:
ok (100 test cases)
Test #11:
score: 0
Accepted
time: 4ms
memory: 3876kb
input:
100 16 16 41 29 27 15 0 1 1 16 16 35 35 25 25 0 1 1 16 16 26 14 10 14 0 1 1 16 16 29 55 27 29 1 1 16 16 36 18 18 18 1 1 16 16 20 28 18 26 0 1 1 16 16 14 26 8 24 1 1 16 16 33 27 17 25 0 1 1 16 16 21 19 17 15 0 1 1 16 16 31 37 29 23 0 1 1 16 16 16 24 16 22 0 1 1 16 16 7 33 5 29 1 1 16 16 27 25 17 19 1...
output:
SCAN 1 16 SCAN 1 1 SCAN 1 6 SCAN 11 1 DIG 8 2 DIG 8 9 DIG 14 2 SCAN 1 16 SCAN 1 1 SCAN 1 9 SCAN 11 1 DIG 6 6 DIG 6 11 DIG 16 6 SCAN 1 16 SCAN 1 1 SCAN 1 6 SCAN 4 1 DIG 1 3 DIG 1 8 DIG 6 3 SCAN 1 16 SCAN 1 1 SCAN 1 15 SCAN 15 1 DIG 14 15 DIG 15 15 SCAN 1 16 SCAN 1 1 SCAN 1 4 SCAN 7 1 DIG 1 1 DIG 13 7...
result:
ok (100 test cases)