結果
| 問題 | No.3598 Queen vs. King |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-29 23:28:35 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 75 ms / 2,000 ms |
| + 0µs | |
| コード長 | 931 bytes |
| 記録 | |
| コンパイル時間 | 4,452 ms |
| コンパイル使用メモリ | 374,760 KB |
| 実行使用メモリ | 6,016 KB |
| 平均クエリ数 | 2132.33 |
| 最終ジャッジ日時 | 2026-07-29 23:29:58 |
| 合計ジャッジ時間 | 6,055 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 10 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
#define rep(i, s, t) for (ll i = s; i < (ll)(t); i++)
#define all(x) begin(x), end(x)
template <class T> bool chmin(T& x, T y) {
return x > y ? (x = y, true) : false;
}
template <class T> bool chmax(T& x, T y) {
return x < y ? (x = y, true) : false;
}
void solve() {
int h, w;
cin >> h >> w;
int x, y;
auto input = [&]() {
cin >> x >> y;
if (x == -1) exit(0);
if (x == 0) return 1;
x--, y--;
return 0;
};
if (input()) return;
int nx = 0, ny = 0;
while (nx < x - 1) {
nx = x - 1;
cout << nx + 1 << ' ' << ny + 1 << endl;
if (input()) return;
}
ny = y;
cout << nx + 1 << ' ' << ny + 1 << endl;
if (input()) return;
cout << x << ' ' << y + 1 << endl;
input();
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(15);
int t = 1;
cin >> t;
while (t--) solve();
}