結果
問題 | No.1588 Connection |
ユーザー |
![]() |
提出日時 | 2021-06-26 20:57:48 |
言語 | C++14 (gcc 11.2.0 + boost 1.78.0) |
結果 |
AC
|
実行時間 | 107 ms / 2,000 ms |
コード長 | 816 bytes |
コンパイル時間 | 579 ms |
使用メモリ | 22,692 KB |
平均クエリ数 | 563.00 |
最終ジャッジ日時 | 2023-02-14 23:57:56 |
合計ジャッジ時間 | 3,891 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 21 ms
22,552 KB |
testcase_01 | AC | 20 ms
21,968 KB |
testcase_02 | AC | 22 ms
22,240 KB |
testcase_03 | AC | 22 ms
21,880 KB |
testcase_04 | AC | 22 ms
22,576 KB |
testcase_05 | AC | 22 ms
21,892 KB |
testcase_06 | AC | 23 ms
21,880 KB |
testcase_07 | AC | 21 ms
21,916 KB |
testcase_08 | AC | 24 ms
22,264 KB |
testcase_09 | AC | 24 ms
22,216 KB |
testcase_10 | AC | 25 ms
21,892 KB |
testcase_11 | AC | 25 ms
21,980 KB |
testcase_12 | AC | 54 ms
22,540 KB |
testcase_13 | AC | 61 ms
21,904 KB |
testcase_14 | AC | 22 ms
22,540 KB |
testcase_15 | AC | 23 ms
21,892 KB |
testcase_16 | AC | 22 ms
22,240 KB |
testcase_17 | AC | 24 ms
21,892 KB |
testcase_18 | AC | 22 ms
21,916 KB |
testcase_19 | AC | 23 ms
21,880 KB |
testcase_20 | AC | 23 ms
21,916 KB |
testcase_21 | AC | 103 ms
22,692 KB |
testcase_22 | AC | 103 ms
21,880 KB |
testcase_23 | AC | 54 ms
22,240 KB |
testcase_24 | AC | 39 ms
21,856 KB |
testcase_25 | AC | 64 ms
22,608 KB |
testcase_26 | AC | 62 ms
21,880 KB |
testcase_27 | AC | 39 ms
21,880 KB |
testcase_28 | AC | 35 ms
21,928 KB |
testcase_29 | AC | 107 ms
21,892 KB |
testcase_30 | AC | 106 ms
22,420 KB |
testcase_31 | AC | 21 ms
21,892 KB |
ソースコード
#include <iostream> #include <queue> 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)); 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)); } shirabeta[ex][ey] = true; } } if (used[N][N] == true) cout << "Yes" << endl; else cout << "No" << endl; return 0; }