結果

問題 No.1852 Divide or Reduce
ユーザー pockynypockyny
提出日時 2022-02-25 22:28:45
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 480 ms / 2,000 ms
コード長 910 bytes
コンパイル時間 1,339 ms
コンパイル使用メモリ 69,620 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-16 17:34:34
合計ジャッジ時間 7,920 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 212 ms
4,376 KB
testcase_02 AC 212 ms
4,376 KB
testcase_03 AC 210 ms
4,380 KB
testcase_04 AC 215 ms
4,380 KB
testcase_05 AC 211 ms
4,376 KB
testcase_06 AC 183 ms
4,380 KB
testcase_07 AC 183 ms
4,376 KB
testcase_08 AC 183 ms
4,380 KB
testcase_09 AC 183 ms
4,380 KB
testcase_10 AC 182 ms
4,380 KB
testcase_11 AC 183 ms
4,380 KB
testcase_12 AC 184 ms
4,376 KB
testcase_13 AC 183 ms
4,376 KB
testcase_14 AC 185 ms
4,384 KB
testcase_15 AC 184 ms
4,376 KB
testcase_16 AC 470 ms
4,380 KB
testcase_17 AC 469 ms
4,380 KB
testcase_18 AC 464 ms
4,380 KB
testcase_19 AC 351 ms
4,380 KB
testcase_20 AC 480 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

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 << "Second\n";
                    else cout << "First\n";
                }
            }
        }
    }
}
0