結果

問題 No.1852 Divide or Reduce
ユーザー customaddonecustomaddone
提出日時 2022-02-26 16:58:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 354 ms / 2,000 ms
コード長 1,689 bytes
コンパイル時間 796 ms
コンパイル使用メモリ 86,440 KB
実行使用メモリ 139,164 KB
最終ジャッジ日時 2023-09-17 18:52:46
合計ジャッジ時間 11,026 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
72,936 KB
testcase_01 AC 227 ms
79,960 KB
testcase_02 AC 228 ms
79,952 KB
testcase_03 AC 226 ms
80,032 KB
testcase_04 AC 228 ms
79,644 KB
testcase_05 AC 227 ms
79,812 KB
testcase_06 AC 237 ms
127,332 KB
testcase_07 AC 221 ms
120,296 KB
testcase_08 AC 237 ms
134,276 KB
testcase_09 AC 215 ms
116,100 KB
testcase_10 AC 227 ms
128,368 KB
testcase_11 AC 234 ms
138,940 KB
testcase_12 AC 234 ms
138,888 KB
testcase_13 AC 234 ms
139,164 KB
testcase_14 AC 239 ms
138,980 KB
testcase_15 AC 234 ms
138,752 KB
testcase_16 AC 349 ms
107,364 KB
testcase_17 AC 349 ms
107,580 KB
testcase_18 AC 354 ms
108,184 KB
testcase_19 AC 309 ms
106,300 KB
testcase_20 AC 325 ms
108,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict, deque, Counter
from heapq import heapify, heappop, heappush
import math
from copy import deepcopy
from itertools import combinations, permutations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right

import sys

def input():
    return sys.stdin.readline().rstrip()
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getListGraph():
    return list(map(lambda x:int(x) - 1, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]

mod = 10 ** 9 + 7
MOD = 998244353
# import pypyjit
# pypyjit.set_param('max_unroll_recursion=-1')
sys.setrecursionlimit(10000000)
inf = float('inf')
eps = 10 ** (-15)
dy = [0, 1, 0, -1]
dx = [1, 0, -1, 0]

#############
# Main Code #
#############

"""
先手はX, Y両方試せる
どこかの山を1とA[i] - 1に分割したらその後はXしか行えない
A[i] - 1の総和が奇数なら後手に偶数個で渡せてXを交互に行うことで先手が勝てる
偶数の場合は操作Yを行い偶数個取り除ければ安全に渡せる
後手も同じ操作を行い先手に渡す
Yを行える回数が奇数なら先手の勝ち
"""

T = getN()
for _ in range(T):
    N = getN()
    A = getList()

    X = 0
    Y = inf
    for a in A:
        X += a - 1
        Y = min(Y, a)
    Y -= 1

    # Xの操作回数が奇数なら
    if X % 2 != 0:
        print('First')
    else:
        # 偶数個引け、かつ奇数回施行できる
        if N % 2 == 0 and Y % 2 != 0:
            print('First')
        else:
            print('Second')
0