結果

問題 No.1588 Connection
ユーザー 沙耶花沙耶花
提出日時 2021-07-08 22:41:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
QLE  
(最初)
実行時間 -
コード長 1,199 bytes
コンパイル時間 4,014 ms
コンパイル使用メモリ 266,868 KB
実行使用メモリ 24,360 KB
平均クエリ数 329.91
最終ジャッジ日時 2023-09-24 10:47:39
合計ジャッジ時間 6,809 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
23,376 KB
testcase_01 AC 25 ms
23,616 KB
testcase_02 AC 23 ms
23,388 KB
testcase_03 AC 23 ms
24,312 KB
testcase_04 AC 23 ms
24,204 KB
testcase_05 AC 22 ms
23,376 KB
testcase_06 AC 23 ms
23,580 KB
testcase_07 AC 22 ms
24,240 KB
testcase_08 AC 24 ms
23,988 KB
testcase_09 AC 25 ms
24,000 KB
testcase_10 AC 27 ms
24,288 KB
testcase_11 AC 26 ms
23,592 KB
testcase_12 AC 52 ms
23,340 KB
testcase_13 AC 51 ms
24,048 KB
testcase_14 AC 24 ms
24,060 KB
testcase_15 AC 24 ms
23,844 KB
testcase_16 AC 25 ms
23,616 KB
testcase_17 AC 24 ms
23,952 KB
testcase_18 AC 24 ms
24,036 KB
testcase_19 AC 23 ms
24,048 KB
testcase_20 AC 24 ms
23,832 KB
testcase_21 AC 83 ms
23,376 KB
testcase_22 AC 81 ms
23,520 KB
testcase_23 AC 47 ms
23,604 KB
testcase_24 AC 37 ms
23,640 KB
testcase_25 AC 55 ms
23,988 KB
testcase_26 AC 54 ms
23,616 KB
testcase_27 AC 38 ms
23,640 KB
testcase_28 AC 34 ms
23,364 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 23 ms
23,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001

unsigned long xor128() {
	static unsigned long x=123456789, y=362436069, z=521288629, w=88675123;
	unsigned long t=(x^(x<<11));
	x=y; y=z; z=w;
	return (w=(w^(w>>19))^(t^(t>>8)));
}

int main(){
	
	int N,M;
	cin>>N>>M;
	
	assert(M<=1000);
	
	vector f(N,vector<bool>(N,false));
	f[0][0] = true;
	f.back().back() = true;
	
	vector<pair<int,int>> Q;
	Q.emplace_back(0,0);
	vector ff(N,vector<bool>(N,false));
	ff[0][0] = true;
	int cnt = 0;
	while(Q.size()>0){
		int ind = xor128()%Q.size();
		int y = Q[ind].first,x = Q[ind].second;
		Q.erase(Q.begin()+ind);
		
		rep(i,2){
			int yy = y+i,xx = x+(i^1);
			if(yy==N-1&&xx==N-1){
				cout<<"Yes"<<endl;
				return 0;
			}
			if(yy>=N||xx>=N)continue;
			if(ff[yy][xx])continue;
			ff[yy][xx] = true;
			assert(cnt!=3000);
			cnt++;
			cout<<yy+1<<' '<<xx+1<<endl;
			
			string ret;
			cin>>ret;
			assert(ret!="-1");
			if(ret=="Black"){
				f[yy][xx] = true;
				Q.emplace_back(yy,xx);
			}
		}
		
	}
	
	cout<<"No"<<endl;
	
	return 0;
}
0