結果

問題 No.1208 anti primenumber game
ユーザー hanbei_dayohanbei_dayo
提出日時 2020-08-30 16:09:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,379 bytes
コンパイル時間 822 ms
コンパイル使用メモリ 86,584 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-27 09:48:06
合計ジャッジ時間 3,573 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 WA -
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 1 ms
6,948 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 1 ms
6,940 KB
testcase_15 AC 29 ms
6,940 KB
testcase_16 AC 29 ms
6,940 KB
testcase_17 AC 29 ms
6,940 KB
testcase_18 AC 29 ms
6,940 KB
testcase_19 AC 28 ms
6,940 KB
testcase_20 AC 29 ms
6,940 KB
testcase_21 WA -
testcase_22 AC 29 ms
6,944 KB
testcase_23 AC 29 ms
6,940 KB
testcase_24 AC 93 ms
6,944 KB
testcase_25 AC 93 ms
6,940 KB
testcase_26 AC 90 ms
6,944 KB
testcase_27 AC 93 ms
6,944 KB
testcase_28 AC 92 ms
6,940 KB
testcase_29 AC 89 ms
6,944 KB
testcase_30 AC 28 ms
6,940 KB
testcase_31 WA -
testcase_32 AC 27 ms
6,944 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 22 ms
6,944 KB
testcase_37 AC 29 ms
6,940 KB
testcase_38 WA -
testcase_39 AC 71 ms
6,944 KB
testcase_40 WA -
testcase_41 AC 33 ms
6,940 KB
testcase_42 AC 35 ms
6,944 KB
testcase_43 AC 35 ms
6,944 KB
testcase_44 WA -
testcase_45 AC 35 ms
6,940 KB
testcase_46 AC 28 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
//#define N (1000000000+7)
#define N (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;

ll inv(ll x,ll power) {
	ll res = 1;
	ll k = power;
	ll y = x%N;
	while (k) {
		if (k & 1)res = (res*y) % N;
		y = (y%N*y%N) % N;
		k /= 2;
	}
	return res;
}


int main(void){
    ll n,m;
    cin>>n>>m;
    vector<ll>a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    ll First = 0,Second = 0,parity = 0;
    for(int i=0;i<n;){
        if(a[i]==1){
            if(i==n-1){
                if(parity==0) First+=1-m;
                else Second+=1-m;
                i++;
            }
            else{
                if(a[i+1]==1){
                    First+=1-m;
                    Second+=1-m;
                    i+=2;
                }
                else{
                    if(parity==0){
                        First+=1-m;
                        parity = 1;
                    }
                    else{
                        Second+=1-m;
                        parity = 0;
                    }
                    i++;
                }
            }
        }
        else{
            if(i==n-1){
                if(parity==0){
                    First+=a[n-1]-1;
                    Second+=1-m;
                }
                else{
                    Second+=a[n-1]-1;
                    First+=1-m;
                }
                i++;
            }
            else{
                if(a[i+1]==1){
                    if(parity==0){
                        First+=a[i]-m;
                        Second+=1-m;
                    }
                    else{
                        Second+=a[i]-m;
                        First+=1-m;
                    }
                    i+=2;
                }
                else{
                    if(parity==0){
                        First+=a[i]-1;
                        Second+=1-m;
                    }
                    else{
                        Second+=a[i]-1;
                        First+=1-m;
                    }
                    i++;
                }
            }
        }
    }
    if(First-Second>0)cout<<"First"<<endl;
    else cout<<"Second"<<endl;
}
 
0