結果
| 問題 | No.761 平均値ゲーム |
| コンテスト | |
| ユーザー |
tktk_snsn
|
| 提出日時 | 2020-12-20 01:48:28 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 357 ms / 2,000 ms |
| コード長 | 651 bytes |
| 記録 | |
| コンパイル時間 | 322 ms |
| コンパイル使用メモリ | 20,696 KB |
| 実行使用メモリ | 53,192 KB |
| 最終ジャッジ日時 | 2026-04-09 17:17:10 |
| 合計ジャッジ時間 | 22,220 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 100 |
ソースコード
from functools import lru_cache
import bisect
from itertools import accumulate
eps = 1e-10
N = int(input())
A = list(map(int, input().split()))
B = list(accumulate(A, initial=0))
@lru_cache(maxsize=None)
def grundy(l, r):
if r == l:
return 0
if r - l == 1:
return 1
sm = B[r] - B[l]
sz = r - l
m = bisect.bisect_left(A, sm / sz - eps)
if l == m:
return 1
tmp = set()
tmp.add(grundy(l, m))
tmp.add(grundy(m, r))
for i, v in enumerate(sorted(tmp)):
if i == v:
continue
return i
return i + 1
if grundy(0, N):
print("First")
else:
print("Second")
tktk_snsn