結果
| 問題 | 
                            No.1208 anti primenumber game
                             | 
                    
| コンテスト | |
| ユーザー | 
                             hanbei_dayo
                         | 
                    
| 提出日時 | 2020-08-30 16:09:39 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 2,379 bytes | 
| コンパイル時間 | 802 ms | 
| コンパイル使用メモリ | 86,340 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-15 10:50:01 | 
| 合計ジャッジ時間 | 3,844 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 35 WA * 9 | 
ソースコード
#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;
}
 
            
            
            
        
            
hanbei_dayo