結果

問題 No.1588 Connection
ユーザー MZKiMZKi
提出日時 2021-07-08 23:54:36
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
QLE  
(最初)
実行時間 -
コード長 1,233 bytes
コンパイル時間 2,868 ms
コンパイル使用メモリ 145,024 KB
実行使用メモリ 24,324 KB
平均クエリ数 474.25
最終ジャッジ日時 2023-09-24 11:48:47
合計ジャッジ時間 6,169 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
23,928 KB
testcase_01 AC 26 ms
23,436 KB
testcase_02 AC 24 ms
23,304 KB
testcase_03 AC 26 ms
24,156 KB
testcase_04 AC 25 ms
23,952 KB
testcase_05 AC 25 ms
23,952 KB
testcase_06 AC 24 ms
23,964 KB
testcase_07 AC 23 ms
23,280 KB
testcase_08 AC 25 ms
24,132 KB
testcase_09 AC 29 ms
23,916 KB
testcase_10 AC 28 ms
23,556 KB
testcase_11 AC 28 ms
24,168 KB
testcase_12 AC 60 ms
24,156 KB
testcase_13 AC 66 ms
23,568 KB
testcase_14 AC 25 ms
23,280 KB
testcase_15 AC 26 ms
24,216 KB
testcase_16 AC 25 ms
23,904 KB
testcase_17 AC 25 ms
24,108 KB
testcase_18 AC 24 ms
23,316 KB
testcase_19 AC 26 ms
23,724 KB
testcase_20 AC 27 ms
24,240 KB
testcase_21 AC 118 ms
23,952 KB
testcase_22 AC 119 ms
23,268 KB
testcase_23 AC 65 ms
23,964 KB
testcase_24 AC 46 ms
23,568 KB
testcase_25 AC 76 ms
23,316 KB
testcase_26 AC 71 ms
23,952 KB
testcase_27 AC 46 ms
24,168 KB
testcase_28 AC 39 ms
23,952 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 26 ms
23,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define eps (double)(1e-9)
#define pi (double) acos(-1)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int ask(int a, int b){
    string ret;
    cout << a+1 << " " << b+1 << endl;
    cin >> ret;
    assert(ret != "-1");
    return (ret == "Black" ? 1 : 0);
}

int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
int main(){
    int n, m;
    cin >> n >> m;
    bool dp[n][n];
    memset(dp, false, sizeof(dp));
    dp[0][0] = true;
    rep(x, n)rep(y, n){
        if(!dp[x][y])continue;
        rep(i, 4){
            int nx = x + dx[i];
            int ny = y + dy[i];
            if(nx < 0 || nx >= n || ny < 0 || ny >= n)continue;
            if(dp[nx][ny])continue;
            if(ask(nx, ny))dp[nx][ny] = true;
        }
    }    
    cout << (dp[n-1][n-1] ? "Yes" : "No") << endl;
}
0