ARC 105D Let’s Play Nim题解
设 c n t i cnt_i cnti表示数 i i i出现的次数。
若 ∀ c n t i ≡ 0 ( m o d 2 ) \forall cnt_i≡0(\mod 2) ∀cnti≡0(mod2),则 S e c o n d Second Second必胜。
否则一定会存在一个数 ≥ ∑ i = 1 n a i 2 \geq \frac{\sum_{i=1}^n a_i}{2} ≥2∑i=1nai,这样就就不可能 ⊕ a i = 0 \oplus a_i=0 ⊕ai=0,取走最后一个的必败。
/*
{
######################
# Author #
# Gary #
# 2020 #
######################
*/
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
#define check_min(a,b) a=min(a,b)
#define check_max(a,b) a=max(a,b)
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
/*}
*/
map<int,int> app;
int N;
void solve(){
app.clear();
scanf("%d",&N);
rb(i,1,N)
{
int ai;
scanf("%d",&ai);
app[ai]++;
}
bool ok=true;
for(auto ite=app.begin();ite!=app.end();ite++){
ok&=!((ite->SEC)&1);
}
ok^=1;
ok^=(N&1);
cout<<(ok? "First":"Second")<<endl;
}
int main(){
int t;
cin>>t;
while(t--){
solve();
}
return 0;
}
/** 程序框架:
*
*
*
*
**/