結果
| 問題 | 
                            No.1588 Connection
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-07-08 22:51:33 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                CE
                                 
                             
                            
                            (最新)
                                AC
                                 
                             
                            (最初)
                            
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,970 bytes | 
| コンパイル時間 | 936 ms | 
| コンパイル使用メモリ | 94,432 KB | 
| 最終ジャッジ日時 | 2025-01-22 19:00:48 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
            
            
            
            
            ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:50:19: error: variable ‘std::array<int, 4> dy’ has initializer but incomplete type
   50 |     array<int, 4> dy{-1, 1, 0, 0}, dx{0, 0, -1, 1};
      |                   ^~
main.cpp:50:36: error: variable ‘std::array<int, 4> dx’ has initializer but incomplete type
   50 |     array<int, 4> dy{-1, 1, 0, 0}, dx{0, 0, -1, 1};
      |                                    ^~
main.cpp: In lambda function:
main.cpp:54:29: error: ‘yy’ was not declared in this scope; did you mean ‘yn’?
   54 |             if(xx == n-1 && yy == n-1){
      |                             ^~
      |                             yn
main.cpp:58:47: error: ‘yy’ was not declared in this scope; did you mean ‘yn’?
   58 |             if(p && 0 <= xx && xx < n && 0 <= yy && yy < n && !~dp[xx][yy]){
      |                                               ^~
      |                                               yn
            
            ソースコード
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
static const int MOD = 1000000007;
using ll = long long;
using uint = unsigned;
using ull = unsigned long long;
using namespace std;
template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;
template <class T, class U>
vector<T> make_v(U size, const T& init){ return vector<T>(static_cast<size_t>(size), init); }
template<class... Ts, class U>
auto make_v(U size, Ts... rest) { return vector<decltype(make_v(rest...))>(static_cast<size_t>(size), make_v(rest...)); }
template<class T> void chmin(T &a, const T &b){ a = (a < b ? a : b); }
template<class T> void chmax(T &a, const T &b){ a = (a > b ? a : b); }
template <class F> struct REC {
  F f;
  REC(F &&f_) : f(std::forward<F>(f_)) {}
  template <class... Args> auto operator()(Args &&... args) const {
    return f(*this, std::forward<Args>(args)...);
  }
};
int main() {
    int n, k;
    cin >> n >> k;
    auto query = [&](int a, int b){
        cout << a+1 << " " << b+1 << endl;
        string s;
        cin >> s;
        if(s == "-1") exit(0);
        if(s == "Black") return 1;
        else return 0;
    };
    int p = 3000;
    auto dp = make_v(n, n, -1);
    dp[0][0] = dp[n-1][n-1] = 1;
    array<int, 4> dy{-1, 1, 0, 0}, dx{0, 0, -1, 1};
    REC([&](auto &&f, int x, int y) -> int {
        for (int dir = 0; dir < 4; ++dir) {
            int xx = x+dx[dir], yy = y+dy[dir];
            if(xx == n-1 && yy == n-1){
                cout << "Yes" << endl;
                exit(0);
            }
            if(p && 0 <= xx && xx < n && 0 <= yy && yy < n && !~dp[xx][yy]){
                dp[xx][yy] = query(xx, yy);
                p--;
                if(dp[xx][yy]) {
                    f(xx, yy);
                }
            }
        }
        return 0;
    })(0, 0);
    cout << "No" << endl;
    return 0;
}