結果

問題 No.761 平均値ゲーム
ユーザー matsu7874
提出日時 2018-12-07 20:48:22
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 291 ms / 2,000 ms
コード長 450 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 22,140 KB
最終ジャッジ日時 2024-09-14 03:36:12
合計ジャッジ時間 14,804 ms
ジャッジサーバーID
(参考情報)
judge6 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 100
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

n = int(input())
a = list(map(int, input().split()))

b = [0] + a[:]
for i in range(n):
    b[i+1] += b[i]


def get_ave(l, r):
    return (b[r]-b[l])/(r-l)


def does_first_win(l, r):
    if a[r-1] == a[l]:
        return True
    th = bisect.bisect_left(a, get_ave(l, r))
    l_hand = not does_first_win(l, th)
    r_hand = not does_first_win(th, r)
    return l_hand or r_hand


print('First' if does_first_win(0, n) else 'Second')
0