結果

問題 No.1588 Connection
ユーザー e869120
提出日時 2021-06-26 21:05:07
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
(最新)
QLE  
(最初)
実行時間 -
コード長 965 bytes
コンパイル時間 661 ms
コンパイル使用メモリ 75,652 KB
実行使用メモリ 25,476 KB
平均クエリ数 3.00
最終ジャッジ日時 2024-07-17 11:33:28
合計ジャッジ時間 3,211 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <queue>
#include <cassert>
using namespace std;

int N, M;
bool used[1009][1009], shirabeta[1009][1009];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0,-1 };
queue<pair<int, int>> Q;

int main() {
	cin >> N >> M;
	used[1][1] = true; shirabeta[1][1] = true; Q.push(make_pair(1, 1));

	cout << "1 1" << endl;
	string str; cin >> str;
	cout << str << endl;
	cout << "No" << endl;
	return 0;

	while (!Q.empty()) {
		int px = Q.front().first, py = Q.front().second; Q.pop();
		for (int i = 0; i < 4; i++) {
			int ex = px + dx[i], ey = py + dy[i];
			if (ex <= 0 || ex > N || ey <= 0 || ey > N) continue;
			if (shirabeta[ex][ey] == true) continue;
			cout << ex << " " << ey << endl;
			string str; cin >> str;
			if (str == "Black") { used[ex][ey] = true; Q.push(make_pair(ex, ey)); }
			assert(str != "-1");
			shirabeta[ex][ey] = true;
		}
	}

	if (used[N][N] == true) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}
0