結果
問題 | No.1588 Connection |
ユーザー | 沙耶花 |
提出日時 | 2021-07-08 22:28:11 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
(最新)
QLE
(最初)
|
実行時間 | - |
コード長 | 1,112 bytes |
コンパイル時間 | 4,452 ms |
コンパイル使用メモリ | 266,636 KB |
実行使用メモリ | 24,336 KB |
平均クエリ数 | 332.34 |
最終ジャッジ日時 | 2023-09-24 10:44:17 |
合計ジャッジ時間 | 7,692 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 31 ms
23,784 KB |
testcase_01 | AC | 28 ms
23,652 KB |
testcase_02 | AC | 26 ms
24,240 KB |
testcase_03 | AC | 27 ms
23,340 KB |
testcase_04 | AC | 27 ms
23,664 KB |
testcase_05 | AC | 26 ms
24,324 KB |
testcase_06 | AC | 27 ms
24,228 KB |
testcase_07 | AC | 26 ms
23,376 KB |
testcase_08 | AC | 27 ms
24,216 KB |
testcase_09 | AC | 29 ms
23,988 KB |
testcase_10 | AC | 30 ms
24,336 KB |
testcase_11 | AC | 31 ms
23,388 KB |
testcase_12 | AC | 59 ms
24,036 KB |
testcase_13 | AC | 58 ms
24,012 KB |
testcase_14 | AC | 27 ms
23,628 KB |
testcase_15 | AC | 28 ms
23,400 KB |
testcase_16 | AC | 26 ms
23,652 KB |
testcase_17 | AC | 27 ms
23,388 KB |
testcase_18 | AC | 26 ms
23,616 KB |
testcase_19 | AC | 28 ms
23,844 KB |
testcase_20 | AC | 28 ms
23,388 KB |
testcase_21 | AC | 91 ms
23,844 KB |
testcase_22 | AC | 92 ms
23,676 KB |
testcase_23 | AC | 52 ms
23,436 KB |
testcase_24 | AC | 40 ms
23,628 KB |
testcase_25 | AC | 61 ms
23,640 KB |
testcase_26 | AC | 60 ms
24,336 KB |
testcase_27 | AC | 40 ms
23,988 KB |
testcase_28 | AC | 37 ms
24,024 KB |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | AC | 27 ms
23,844 KB |
ソースコード
#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 int main(){ int N,M; cin>>N>>M; vector f(N,vector<bool>(N,false)); f[0][0] = true; f.back().back() = true; queue<pair<int,int>> Q; Q.emplace(0,0); vector ff(N,vector<bool>(N,false)); ff[0][0] = true; while(Q.size()>0){ int y = Q.front().first,x = Q.front().second; Q.pop(); rep(i,2){ int yy = y+i,xx = x+(i^1); if(yy>=N||xx>=N)continue; if(ff[yy][xx])continue; ff[yy][xx] = true; cout<<yy+1<<' '<<xx+1<<endl; string ret; cin>>ret; if(ret=="Black"){ f[yy][xx] = true; Q.emplace(yy,xx); } } } vector dp(N,vector<bool>(N,false)); dp[0][0] = true; rep(i,N){ rep(j,N){ if(dp[i][j]==false)continue; rep(k,2){ int yy = i+k,xx = j+(k^1); if(yy>=N||xx>=N)continue; if(f[yy][xx]==false)continue; dp[yy][xx] = true; } } } if(dp.back().back())cout<<"Yes"<<endl; else cout<<"No"<<endl; return 0; }