結果

問題 No.1208 anti primenumber game
ユーザー t98slider
提出日時 2023-07-24 02:51:29
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 714 bytes
コンパイル時間 1,741 ms
コンパイル使用メモリ 174,292 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-25 05:35:12
合計ジャッジ時間 4,513 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 36 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    ll m, v = 0;
    cin >> n >> m;
    vector<ll> a(n);
    for(auto &&v : a) cin >> v;
    sort(a.rbegin(), a.rend());
    if(m >= 1){
        int turn = 0;
        for(int i = 0; i < n; i++){
            if(a[i] == 1) break;
            v += turn ? -(a[i] - 1) : (a[i] - 1);
            turn ^= 1;
        }
        for(int i = 0; i < n; i++){
            v += turn ? m - 1 : -m + 1;
            turn ^= 1;
        }
    }else{
        for(int i = 0; i < n; i++){
            v += i & 1 ? -a[i] : a[i];
        }
    }
    cout << (v > 0 ? "First" : "Second") << '\n';
}
0