結果

問題 No.726 Tree Game
ユーザー xuzijian629xuzijian629
提出日時 2018-08-28 04:04:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 976 bytes
コンパイル時間 678 ms
コンパイル使用メモリ 90,592 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-20 15:28:37
合計ジャッジ時間 2,161 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 1 ms
4,376 KB
testcase_05 WA -
testcase_06 AC 1 ms
4,380 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
4,380 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
4,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <cassert>
using namespace std;
using i64 = int64_t;
constexpr i64 mod = 1e9 + 7;
using vi = vector<i64>;
using vvi = vector<vi>;
using ii = pair<i64, i64>;
using vii = vector<ii>;

bool is_prime(i64 a) {
    if (a == 2) return true;
    if (a % 2 == 0) return false;
    for (int i = 3; i * i <= a; i += 2) {
        if (a % i == 0) return false;
    }
    return true;
}

bool is_prime(ii a) {
    return is_prime(a.first) || is_prime(a.second);
}

int main() {
    int y, x;
    cin >> y >> x;
    if (is_prime(ii(x, y))) {
        cout << "First" << endl;
        return 0;
    }
    if (is_prime(ii(x + 1, y)) && is_prime(ii(x, y + 1))) {
        cout << "Second" << endl;
        return 0;
    }
    if ((x + y) % 2 == 0) {
        cout << "First" << endl;
    } else {
        cout << "Second" << endl;
    }
}
0