結果
| 問題 | No.1208 anti primenumber game | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-08-30 16:32:16 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 41 ms / 2,000 ms | 
| コード長 | 692 bytes | 
| コンパイル時間 | 765 ms | 
| コンパイル使用メモリ | 75,504 KB | 
| 最終ジャッジ日時 | 2025-01-14 00:00:57 | 
| ジャッジサーバーID (参考情報) | judge3 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 44 | 
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
using lint = long long;
void solve() {
    int n;
    lint m;
    std::cin >> n >> m;
    std::vector<lint> xs(n);
    for (auto& x : xs) std::cin >> x;
    std::reverse(xs.begin(), xs.end());
    lint score = 0;
    for (auto x : xs) {
        // get all stone
        lint nscore = x - m - score;
        if (x > 1) {
            // leave a stone
            nscore = std::max(nscore, (x - 1) - (1 - m) + score);
        }
        score = nscore;
    }
    std::cout << (score > 0 ? "First" : "Second") << "\n";
}
int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    solve();
    return 0;
}
            
            
            
        