結果

問題 No.1588 Connection
ユーザー yakkiyakki
提出日時 2021-07-08 23:38:31
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,632 bytes
コンパイル時間 1,327 ms
コンパイル使用メモリ 128,972 KB
実行使用メモリ 24,420 KB
平均クエリ数 275.78
最終ジャッジ日時 2023-09-24 11:43:22
合計ジャッジ時間 6,628 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
23,976 KB
testcase_01 RE -
testcase_02 AC 26 ms
23,964 KB
testcase_03 AC 26 ms
23,952 KB
testcase_04 AC 26 ms
23,940 KB
testcase_05 AC 27 ms
24,252 KB
testcase_06 AC 26 ms
23,568 KB
testcase_07 AC 26 ms
23,760 KB
testcase_08 AC 27 ms
24,180 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 26 ms
23,460 KB
testcase_15 AC 27 ms
24,252 KB
testcase_16 AC 26 ms
23,760 KB
testcase_17 AC 26 ms
23,304 KB
testcase_18 AC 26 ms
23,544 KB
testcase_19 AC 27 ms
23,952 KB
testcase_20 AC 28 ms
23,784 KB
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 AC 52 ms
23,352 KB
testcase_26 AC 61 ms
23,472 KB
testcase_27 AC 40 ms
24,240 KB
testcase_28 AC 37 ms
24,252 KB
testcase_29 WA -
testcase_30 RE -
testcase_31 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<numeric>
#include<ctime>
//#include<atcoder/all>
using namespace std;
//using namespace atcoder;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592
#define PI acos(-1.0)

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;
//using mint = modint998244353;

int dh[] = {1,0,-1,0};
int dw[] = {0,1,0,-1};


int main(){
    int n,m; cin >> n >> m;
    queue<Pi> q;
    q.push({1,1});
    vector<vector<bool>> used(n,vector<bool>(n));
    used[0][0] = true;
    while(!q.empty()){
        auto u = q.front();
        int u1 = u.first;
        int u2 = u.second;
        if(u1 == n and u2 == n){
            cout << "Yes" << endl;
            return 0;
        }
        q.pop();
        if(2*n-u1-u2+1 > m) continue;
        cout << u1 << " " << u2 << endl;
        string t; cin >> t;
        if(t == "White") continue;
        m--;
        rep(i,2){
            int nu1 = u1+dh[i];
            int nu2 = u2+dw[i];
            if(nu1 <= n and nu2 <= n){
                if(used[nu1][nu2]) continue;
                used[nu1][nu2] = true;
                q.push({nu1,nu2});
            }
        }
    }
    cout << "No" << endl;
}

0