結果

問題 No.726 Tree Game
ユーザー kappybarkappybar
提出日時 2020-04-15 17:46:51
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,228 bytes
コンパイル時間 1,642 ms
コンパイル使用メモリ 169,528 KB
実行使用メモリ 226,176 KB
最終ジャッジ日時 2024-04-09 18:54:27
合計ジャッジ時間 6,030 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 148 ms
225,920 KB
testcase_01 AC 150 ms
225,920 KB
testcase_02 AC 154 ms
225,920 KB
testcase_03 AC 150 ms
225,920 KB
testcase_04 AC 154 ms
225,920 KB
testcase_05 AC 150 ms
226,048 KB
testcase_06 AC 151 ms
225,920 KB
testcase_07 WA -
testcase_08 AC 155 ms
225,920 KB
testcase_09 WA -
testcase_10 AC 152 ms
225,920 KB
testcase_11 AC 153 ms
225,920 KB
testcase_12 AC 151 ms
226,048 KB
testcase_13 AC 149 ms
225,920 KB
testcase_14 AC 151 ms
226,048 KB
testcase_15 AC 148 ms
225,920 KB
testcase_16 AC 151 ms
225,920 KB
testcase_17 AC 148 ms
225,920 KB
testcase_18 AC 148 ms
225,920 KB
testcase_19 AC 151 ms
225,920 KB
testcase_20 AC 151 ms
225,920 KB
testcase_21 AC 155 ms
225,920 KB
testcase_22 AC 153 ms
226,176 KB
testcase_23 AC 150 ms
225,920 KB
testcase_24 AC 150 ms
226,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll =  long long ;
using P = pair<int,int> ;
const int INF = 1e9;
const int MOD = 1000000007;

int prime(int x){
    int res;
    int now = x+1;
    while(1){
        bool ok = true;
        for(int i=2;i*i<=now;i++){
            if(now%i == 0){
                ok = false;
                break;
            }
        }
        if(ok){
            res = now;
            break;
        }else{
            now ++;
        }
    }
    return res;
}

int x_p = 30000,y_p = 30000;
vector<vector<bool>> maze(x_p+1,vector<bool>(y_p+1,false));
vector<vector<bool>> seen(x_p+1,vector<bool>(y_p+1,false));

bool dfs(int i,int j){
    if(seen[i][j]) return maze[i][j];
    seen[i][j] = true;
    if(i==x_p-1 && j==y_p-1) return maze[i][j] = false;
    if(i==x_p || j==y_p) return maze[i][j] = true;
    bool res = !dfs(i+1,j) || !dfs(i,j+1);
    return maze[i][j] = res;
}

int main(){
    int x,y;
    cin >> x >> y;
    x_p = prime(x) - x;
    y_p = prime(y) - y;
    cout << ( dfs(0,0) ? "First" : "Second" ) << endl;
    /*rep(i,x_p+1){
        rep(j,y_p+1) cout << (maze[i][j] ? "Y" : "N") << " ";
        cout << endl;
    }*/
    return 0;
}
0