結果

問題 No.1852 Divide or Reduce
ユーザー pockynypockyny
提出日時 2022-02-25 22:27:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 910 bytes
コンパイル時間 748 ms
コンパイル使用メモリ 69,848 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-16 17:31:51
合計ジャッジ時間 7,682 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 182 ms
4,388 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 348 ms
4,384 KB
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;
int a[200010];
int main(){
    int t; cin >> t;
    while(t){
        t--;
        int i,n; cin >> n;
        for(i=0;i<n;i++) cin >> a[i];
        int mn = 1000000001;
        for(i=0;i<n;i++) mn = min(a[i],mn);
        if(mn==1){
            int c = 0;
            for(i=0;i<n;i++){
                if(!(a[i]&1)) c++;
            }
            if(c&1) cout << "First\n";
            else cout << "Second\n";
        }else{
            int od = 0,ev = 0;
            for(i=0;i<n;i++){
                if(a[i]&1) od++;
                else ev++;
            }
            if(ev&1){
                cout << "First\n"; 
            }else{
                if(od&1){
                    cout << "Second\n";
                }else{
                    if(mn&1) cout << "First\n";
                    else cout << "Second\n";
                }
            }
        }
    }
}
0