結果

問題 No.715 集合と二人ゲーム
ユーザー ytftytft
提出日時 2021-04-07 00:06:13
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 814 bytes
コンパイル時間 1,610 ms
コンパイル使用メモリ 171,804 KB
実行使用メモリ 7,340 KB
最終ジャッジ日時 2023-09-02 17:51:46
合計ジャッジ時間 8,182 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 7 ms
5,296 KB
testcase_04 AC 7 ms
5,216 KB
testcase_05 AC 9 ms
5,156 KB
testcase_06 WA -
testcase_07 AC 10 ms
5,084 KB
testcase_08 AC 11 ms
5,156 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 14 ms
5,216 KB
testcase_12 AC 15 ms
5,288 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 18 ms
5,216 KB
testcase_16 AC 19 ms
5,220 KB
testcase_17 AC 18 ms
5,140 KB
testcase_18 WA -
testcase_19 AC 21 ms
5,084 KB
testcase_20 AC 23 ms
5,292 KB
testcase_21 WA -
testcase_22 AC 25 ms
5,156 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 27 ms
5,432 KB
testcase_26 WA -
testcase_27 AC 30 ms
5,416 KB
testcase_28 WA -
testcase_29 AC 31 ms
5,368 KB
testcase_30 WA -
testcase_31 AC 25 ms
5,156 KB
testcase_32 AC 22 ms
5,100 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 4 ms
5,168 KB
testcase_36 AC 4 ms
4,824 KB
testcase_37 AC 3 ms
4,888 KB
testcase_38 AC 4 ms
4,892 KB
testcase_39 AC 4 ms
4,952 KB
testcase_40 WA -
testcase_41 AC 4 ms
4,820 KB
testcase_42 WA -
testcase_43 AC 4 ms
4,956 KB
testcase_44 WA -
testcase_45 AC 4 ms
4,840 KB
testcase_46 AC 4 ms
5,032 KB
testcase_47 AC 4 ms
4,872 KB
testcase_48 WA -
testcase_49 AC 4 ms
4,948 KB
testcase_50 AC 165 ms
6,936 KB
testcase_51 AC 165 ms
6,932 KB
testcase_52 WA -
testcase_53 AC 158 ms
6,952 KB
testcase_54 WA -
testcase_55 AC 164 ms
7,084 KB
testcase_56 AC 156 ms
6,724 KB
testcase_57 WA -
testcase_58 AC 163 ms
7,256 KB
testcase_59 AC 165 ms
6,988 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int N;
    cin>>N;
    vector<int> a(N);
    for(int i=0;i<N;i++){
        cin>>a[i];
    }
    sort(a.begin(),a.end());
    vector<int> b;
    int temp=1;
    for(int i=1;i<N;i++){
        if(a[i-1]+1<a[i]){
            b.push_back(temp);
            temp=1;
        }else if(a[i-1]+1==a[i]){
            temp++;
        }
    }
    b.push_back(temp);
    vector<int> grundy(500001,0);
    grundy[1]=1;
    grundy[2]=1;
    for(int i=3;i<500001;i++){
        if(grundy[i-3]+grundy[i-2]==1){
            grundy[i]=2;
        }else if(grundy[i-3]*grundy[i-2]==0){
            grundy[i]=1;
        }else{
            grundy[i]=0;
        }
    }
    int ans=0;
    for(int i:b){
        ans=ans^grundy[i];
    }
    cout<<(ans?"First":"Second")<<endl;
}
0