結果
問題 |
No.761 平均値ゲーム
|
ユーザー |
![]() |
提出日時 | 2020-03-19 14:51:21 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 78 ms / 2,000 ms |
コード長 | 630 bytes |
コンパイル時間 | 111 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 21,120 KB |
最終ジャッジ日時 | 2024-12-14 03:13:22 |
合計ジャッジ時間 | 7,810 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 100 |
ソースコード
#!/usr/bin/ python3.8 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 5) import itertools from bisect import bisect_left N = int(readline()) A = tuple(map(int, read().split())) Acum = (0,) + tuple(itertools.accumulate(A)) def solve(L, R): """result on interval [L,R)""" S = Acum[R] - Acum[L] n = R - L x = (S + n - 1) // n i = bisect_left(A, x, lo=L, hi=R) if i == L: return True if not solve(L, i): return True return not solve(i, R) print('First' if solve(0,N) else 'Second')