QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#664527 | #7156. Find the Box | blackslex# | 0 | 1ms | 3548kb | C++14 | 984b | 2024-10-21 21:00:57 | 2024-10-21 21:00:58 |
answer
#include<bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
int n, m, px, py;
pii pos;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
cin >> n >> m;
string s = "";
auto ask = [&] () {
int r, c;
cout << "? " << s << endl;
cin >> r >> c;
pos = pii(r, c);
return;
};
if (n < m) {
for (int j = 0; j < m - 1; j++) {
s = string(j, '>') + string(n - 1, 'v');
ask();
if (pos != pii(n - 1, j)) {
cout << "! " << pos.first + 1 << ' ' << pos.second << endl;
return 0;
}
}
} else {
for (int i = 0; i < n - 1; i++) {
s = string(i, 'v') + string(m - 1, '>');
ask();
if (pos != pii(i, m - 1)) {
cout << "! " << pos.first << ' ' << pos.second + 1 << endl;
return 0;
}
}
}
}
详细
Test #1:
score: 0
Acceptable Answer
time: 1ms
memory: 3548kb
input:
4 5 3 0 3 1 3 2 1 3
output:
? vvv ? >vvv ? >>vvv ? >>>vvv ! 2 3
result:
points 0.710 0.71 used 4 queried; score: 71.00