結果

問題 No.1208 anti primenumber game
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2020-08-31 21:58:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,337 bytes
コンパイル時間 1,611 ms
コンパイル使用メモリ 168,340 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-28 11:19:01
合計ジャッジ時間 5,486 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 31 ms
5,376 KB
testcase_16 AC 31 ms
5,376 KB
testcase_17 AC 31 ms
5,376 KB
testcase_18 AC 30 ms
5,376 KB
testcase_19 AC 30 ms
5,376 KB
testcase_20 AC 31 ms
5,376 KB
testcase_21 AC 32 ms
5,376 KB
testcase_22 AC 31 ms
5,376 KB
testcase_23 AC 32 ms
5,376 KB
testcase_24 AC 102 ms
5,376 KB
testcase_25 AC 102 ms
5,376 KB
testcase_26 AC 95 ms
5,376 KB
testcase_27 AC 92 ms
5,376 KB
testcase_28 AC 92 ms
5,376 KB
testcase_29 AC 94 ms
5,376 KB
testcase_30 AC 31 ms
5,376 KB
testcase_31 AC 30 ms
5,376 KB
testcase_32 AC 32 ms
5,376 KB
testcase_33 WA -
testcase_34 AC 32 ms
5,376 KB
testcase_35 AC 30 ms
5,376 KB
testcase_36 AC 24 ms
5,376 KB
testcase_37 AC 30 ms
5,376 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 36 ms
5,376 KB
testcase_42 AC 37 ms
5,376 KB
testcase_43 AC 35 ms
5,376 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2020.08.31 21:57:57
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

int main() {
    ll n,m;cin >> n >> m;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    if (m == 0) {
        ll p = 0, q = 0;
        int turn = 0;
        for (int i = 0; i < n; i++) {
            if (turn == 0) {
                if (a[i] == 1) {
                    p += a[i];
                    turn = 1 - turn;
                }
                else if (i == n-1) {
                    p += a[i];
                    turn = 1 - turn;
                }
                else {
                    if (a[i+1] == 1) {
                        p += a[i];
                        turn = 1 - turn;
                    }
                    else {
                        p += a[i] - 1;
                        q += 1;
                    }
                }
            }
            else {
                if (a[i] == 1) {
                    q += a[i];
                    turn = 1 - turn;
                }
                else if (i == n-1) {
                    q += a[i];
                    turn = 1 - turn;
                }
                else {
                    if (a[i+1] == 1) {
                        q += a[i];
                        turn = 1 - turn;
                    }
                    else {
                        q += a[i] - 1;
                        p += 1;
                    }
                }
            }
        }
        if (p > q) puts("First");
        else puts("Second");
    }
    else {
        ll p = 0,q = 0;
        int turn = 0;
        for (int i = 0; i < n; i++) {
            if (turn == 0) {
                if (a[i] == 1) {
                    p += 1 - m;
                    turn = 1 - turn;
                }
                else {
                    p += a[i] - 1;
                    q += 1 - m;
                }
            }
            else {
                if (a[i] == 1) {
                    q += 1 - m;
                    turn = 1 - turn;
                }
                else {
                    q += a[i] - 1;
                    p += 1 - m;
                }
            }
        }
        if (p > q) puts("First");
        else puts("Second");
    }
    return 0;
}
0