結果

問題 No.3598 Queen vs. King
コンテスト
ユーザー askr58
提出日時 2026-07-24 21:52:53
言語 C++23
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 85 ms / 2,000 ms
+ 0µs
コード長 1,175 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,094 ms
コンパイル使用メモリ 179,288 KB
実行使用メモリ 5,888 KB
平均クエリ数 1885.58
最終ジャッジ日時 2026-07-24 21:54:51
合計ジャッジ時間 2,472 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <cassert>
#include <ranges>
#include <algorithm>
#include <vector>
using namespace std;
using ll=long long;
int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int ttt;
	cin>>ttt;
	while(ttt--){
		int h,w;
		cin>>h>>w;
		int x,y;
		cin>>x>>y;
		if(x==h&&y==w-1){
			cout<<h-1<<" "<<1<<endl;
			cin>>x>>y;
			if(y==w-2){
				cout<<h-1<<" "<<w-2<<endl;
			}else{
				cout<<h-1<<" "<<w<<endl;
			}
			cin>>x>>y;
			assert(x==0&&y==0);
		}else if(x==h-1&&y==w){
			cout<<1<<" "<<w-1<<endl;
			cin>>x>>y;
			if(x==h-2){
				cout<<h-2<<" "<<w-1<<endl;
			}else{
				cout<<h<<" "<<w-1<<endl;
			}
			cin>>x>>y;
			assert(x==0&&y==0);
		}else if(h==3){
			cout<<2<<" "<<1<<endl;
			cin>>x>>y;
			if(!(x==0&&y==0)){
				cout<<2<<" "<<y<<endl;
				cin>>x>>y;
			}
			assert(x==0&&y==0);
		}else{
			cout<<h-2<<" "<<1<<endl;
			cin>>x>>y;
			if(x==h-1){
				cout<<h-2<<" "<<y<<endl;
				cin>>x>>y;
				if(!(x==0&&y==0)){
					cout<<h-1<<" "<<y<<endl;
					cin>>x>>y;
				}
			}else{
				cout<<h-1<<" "<<1<<endl;
				cin>>x>>y;
				if(!(x==0&&y==0)){
					cout<<h-1<<" "<<y<<endl;
					cin>>x>>y;
				}
			}
			assert(x==0&&y==0);
		}
	}
}
			
			
0