結果

問題 No.1852 Divide or Reduce
ユーザー hourenhouren
提出日時 2022-02-25 23:44:41
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 480 ms / 2,000 ms
コード長 871 bytes
コンパイル時間 1,373 ms
コンパイル使用メモリ 163,416 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-16 19:18:19
合計ジャッジ時間 8,664 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 214 ms
4,380 KB
testcase_02 AC 214 ms
4,380 KB
testcase_03 AC 214 ms
4,380 KB
testcase_04 AC 215 ms
4,376 KB
testcase_05 AC 213 ms
4,380 KB
testcase_06 AC 186 ms
4,376 KB
testcase_07 AC 180 ms
4,380 KB
testcase_08 AC 185 ms
4,380 KB
testcase_09 AC 180 ms
4,376 KB
testcase_10 AC 178 ms
4,376 KB
testcase_11 AC 178 ms
4,376 KB
testcase_12 AC 179 ms
4,380 KB
testcase_13 AC 178 ms
4,376 KB
testcase_14 AC 180 ms
4,380 KB
testcase_15 AC 181 ms
4,376 KB
testcase_16 AC 462 ms
4,376 KB
testcase_17 AC 465 ms
4,376 KB
testcase_18 AC 464 ms
4,376 KB
testcase_19 AC 341 ms
4,376 KB
testcase_20 AC 480 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool chmax(T&a, const T&b){if(a<b){a=b;return 1;}return 0;}

int main(){
    int t;
    cin >> t;
    rep(houren,t){
        ll n,tot=0,mi=10010010010001;
        bool ans;
        cin >> n;
        rep(i,n){
            ll a;
            cin >> a;
            tot += a-1;
            mi = min(mi, a-1);
        }
        if(tot%2) ans = true;
        else{
            if(!mi) ans = false;
            else{
                if(n%2) ans = false;
                else ans = mi%2;
            }
        }
        if(ans) cout << "First" << '\n';
        else cout << "Second" << '\n';
    }
    return 0;
}
0