結果

問題 No.1208 anti primenumber game
ユーザー
提出日時 2020-10-01 03:47:29
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,063 bytes
コンパイル時間 700 ms
コンパイル使用メモリ 92,564 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-06 19:49:35
合計ジャッジ時間 3,650 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
long long a[200020];
int main() {
    long long n, m;
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    long long f = 0, s = 0;
    bool b = true;
    for (int i = 0; i < n; i++) {
        if (b) {
            if (a[i] == 1) {
                b = false;
                f -= m - 1;
            }
            else {
                f += a[i] - 1;
                s -= m - 1;
            }
        }
        else {
            if (a[i] == 1) {
                b = true;
                s -= m - 1;
            }
            else {
                s += a[i] - 1;
                f -= m - 1;
            }
        }
    }
    if (f > s) {
        cout << "First" << endl;
    }
    else {
        cout << "Second" << endl;
    }
    return 0;
}
0