結果
| 問題 | No.3090 NimNim |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-05-28 23:34:33 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 603 bytes |
| 記録 | |
| コンパイル時間 | 1,795 ms |
| コンパイル使用メモリ | 198,400 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-05-28 23:34:38 |
| 合計ジャッジ時間 | 4,503 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 WA * 5 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
bool nim(vector<int> a){
int xsum=0;
for(auto x:a) xsum^=x;
return (xsum?true:false);}
bool dnim(vector<int> a){
int xsum=0;
bool icidake=true;
for(auto x:a){
if(x!=1) icidake=false;
xsum^=x;
}if(icidake)return (xsum==0?true:false);
return (xsum?true:false);}
int main(){
int n,m;cin>>n>>m;
vector<int> a(n),b(m);
for(int i=0;i<n;i++) cin>>a[i];
for(int i=0;i<m;i++) cin>>b[i];
bool f=nim(a),g=dnim(a);
if(f) cout<<"First\n";
else if(!g) cout<<"Second\n";
else if(dnim(a)&&nim(b)) cout<<"First\n";
else cout<<"Second\n";
return 0;}