結果

問題 No.726 Tree Game
ユーザー kappybarkappybar
提出日時 2020-04-15 17:11:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,177 bytes
コンパイル時間 1,586 ms
コンパイル使用メモリ 169,304 KB
実行使用メモリ 28,928 KB
最終ジャッジ日時 2024-04-09 18:52:08
合計ジャッジ時間 3,072 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
28,800 KB
testcase_01 AC 18 ms
28,800 KB
testcase_02 AC 18 ms
28,672 KB
testcase_03 AC 18 ms
28,672 KB
testcase_04 WA -
testcase_05 AC 22 ms
28,672 KB
testcase_06 WA -
testcase_07 AC 20 ms
28,672 KB
testcase_08 AC 19 ms
28,672 KB
testcase_09 AC 19 ms
28,672 KB
testcase_10 AC 19 ms
28,672 KB
testcase_11 WA -
testcase_12 AC 19 ms
28,672 KB
testcase_13 WA -
testcase_14 AC 20 ms
28,672 KB
testcase_15 AC 20 ms
28,672 KB
testcase_16 AC 19 ms
28,672 KB
testcase_17 AC 20 ms
28,672 KB
testcase_18 AC 19 ms
28,800 KB
testcase_19 AC 19 ms
28,672 KB
testcase_20 AC 19 ms
28,672 KB
testcase_21 AC 18 ms
28,800 KB
testcase_22 AC 19 ms
28,672 KB
testcase_23 AC 20 ms
28,672 KB
testcase_24 AC 20 ms
28,672 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 = 10000,y_p = 10000;
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;
    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