結果

問題 No.3598 Queen vs. King
コンテスト
ユーザー pengin_2000
提出日時 2026-07-24 21:50:52
言語 C
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 110 ms / 2,000 ms
+ 1µs
コード長 873 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 58 ms
コンパイル使用メモリ 35,968 KB
実行使用メモリ 6,016 KB
平均クエリ数 2167.42
最終ジャッジ日時 2026-07-24 21:52:17
合計ジャッジ時間 1,529 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<stdio.h>
void solve()
{
	int h, w;
	scanf("%d %d", &h, &w);
	int x, y;
	scanf("%d %d", &x, &y);
	if (x <= 0)
		return;
	int nx, ny;
	nx = ny = 1;
	if (y > 2)
	{
		ny = y - 1;
		printf("%d %d\n", nx, ny);
		fflush(stdout);
		scanf("%d %d", &x, &y);
		if (x <= 0)
			return;
		nx = x;
		printf("%d %d\n", nx, ny);
		fflush(stdout);
		scanf("%d %d", &x, &y);
		if (x <= 0)
			return;
		nx = x;
		ny++;
		printf("%d %d\n", nx, ny);
		fflush(stdout);
	}
	else
	{
		nx = x - 1;
		printf("%d %d\n", nx, ny);
		fflush(stdout);
		scanf("%d %d", &x, &y);
		if (x <= 0)
			return;
		ny = y;
		printf("%d %d\n", nx, ny);
		fflush(stdout);
		scanf("%d %d", &x, &y);
		if (x <= 0)
			return;
		nx++;
		ny = y;
		printf("%d %d\n", nx, ny);
		fflush(stdout);
	}
	scanf("%d %d", &x, &y);
	return;
}
int main()
{
	int t;
	scanf("%d", &t);
	for (; t > 0; t--)
		solve();
	return 0;
}
0