結果

問題 No.1588 Connection
ユーザー yakkiyakki
提出日時 2021-07-08 23:43:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
QLE  
(最初)
実行時間 -
コード長 1,714 bytes
コンパイル時間 1,295 ms
コンパイル使用メモリ 129,348 KB
実行使用メモリ 24,384 KB
平均クエリ数 308.25
最終ジャッジ日時 2023-09-24 11:44:56
合計ジャッジ時間 4,254 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
23,568 KB
testcase_01 AC 24 ms
23,568 KB
testcase_02 AC 23 ms
23,664 KB
testcase_03 AC 23 ms
23,424 KB
testcase_04 AC 24 ms
24,264 KB
testcase_05 AC 26 ms
23,436 KB
testcase_06 AC 25 ms
23,352 KB
testcase_07 AC 24 ms
23,412 KB
testcase_08 AC 25 ms
23,772 KB
testcase_09 AC 30 ms
24,384 KB
testcase_10 AC 31 ms
23,556 KB
testcase_11 AC 29 ms
23,700 KB
testcase_12 AC 57 ms
23,580 KB
testcase_13 AC 58 ms
24,264 KB
testcase_14 AC 26 ms
24,276 KB
testcase_15 AC 26 ms
23,772 KB
testcase_16 AC 26 ms
23,964 KB
testcase_17 AC 26 ms
23,340 KB
testcase_18 AC 25 ms
24,084 KB
testcase_19 AC 26 ms
23,772 KB
testcase_20 AC 27 ms
23,592 KB
testcase_21 AC 74 ms
24,060 KB
testcase_22 AC 90 ms
23,448 KB
testcase_23 AC 51 ms
23,568 KB
testcase_24 AC 37 ms
23,400 KB
testcase_25 AC 49 ms
23,760 KB
testcase_26 AC 58 ms
24,084 KB
testcase_27 AC 38 ms
23,460 KB
testcase_28 AC 37 ms
23,568 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 24 ms
23,952 KB
権限があれば一括ダウンロードができます

ソースコード

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({2,1});
    q.push({1,2});
    vector<vector<bool>> used(n,vector<bool>(n));
    used[0][0] = true;
    used[0][1] = true;
    used[1][0] = true;
    m--;
    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-1][nu2-1]) continue;
                used[nu1-1][nu2-1] = true;
                q.push({nu1,nu2});
            }
        }
    }
    cout << "No" << endl;
}

0