結果

問題 No.761 平均値ゲーム
ユーザー tktk_snsntktk_snsn
提出日時 2020-12-20 01:48:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 472 ms / 2,000 ms
コード長 651 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 11,964 KB
実行使用メモリ 49,604 KB
最終ジャッジ日時 2023-10-21 10:10:08
合計ジャッジ時間 23,932 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
10,240 KB
testcase_01 AC 30 ms
10,240 KB
testcase_02 AC 30 ms
10,240 KB
testcase_03 AC 29 ms
10,240 KB
testcase_04 AC 30 ms
10,240 KB
testcase_05 AC 30 ms
10,240 KB
testcase_06 AC 31 ms
10,240 KB
testcase_07 AC 29 ms
10,240 KB
testcase_08 AC 30 ms
10,240 KB
testcase_09 AC 30 ms
10,240 KB
testcase_10 AC 31 ms
10,240 KB
testcase_11 AC 30 ms
10,240 KB
testcase_12 AC 30 ms
10,240 KB
testcase_13 AC 30 ms
10,240 KB
testcase_14 AC 30 ms
10,240 KB
testcase_15 AC 30 ms
10,240 KB
testcase_16 AC 30 ms
10,240 KB
testcase_17 AC 30 ms
10,240 KB
testcase_18 AC 30 ms
10,240 KB
testcase_19 AC 30 ms
10,240 KB
testcase_20 AC 31 ms
10,240 KB
testcase_21 AC 30 ms
10,240 KB
testcase_22 AC 30 ms
10,240 KB
testcase_23 AC 29 ms
10,240 KB
testcase_24 AC 30 ms
10,240 KB
testcase_25 AC 30 ms
10,240 KB
testcase_26 AC 30 ms
10,240 KB
testcase_27 AC 30 ms
10,240 KB
testcase_28 AC 31 ms
10,240 KB
testcase_29 AC 30 ms
10,240 KB
testcase_30 AC 30 ms
10,240 KB
testcase_31 AC 30 ms
10,240 KB
testcase_32 AC 30 ms
10,240 KB
testcase_33 AC 338 ms
34,408 KB
testcase_34 AC 390 ms
37,392 KB
testcase_35 AC 56 ms
12,704 KB
testcase_36 AC 222 ms
29,520 KB
testcase_37 AC 317 ms
33,456 KB
testcase_38 AC 312 ms
33,380 KB
testcase_39 AC 399 ms
38,108 KB
testcase_40 AC 394 ms
37,832 KB
testcase_41 AC 370 ms
36,560 KB
testcase_42 AC 418 ms
48,776 KB
testcase_43 AC 90 ms
15,356 KB
testcase_44 AC 265 ms
31,096 KB
testcase_45 AC 364 ms
36,008 KB
testcase_46 AC 196 ms
23,884 KB
testcase_47 AC 211 ms
29,260 KB
testcase_48 AC 46 ms
11,728 KB
testcase_49 AC 432 ms
48,720 KB
testcase_50 AC 72 ms
14,920 KB
testcase_51 AC 53 ms
12,448 KB
testcase_52 AC 56 ms
12,728 KB
testcase_53 AC 419 ms
48,608 KB
testcase_54 AC 246 ms
30,572 KB
testcase_55 AC 421 ms
48,652 KB
testcase_56 AC 130 ms
19,892 KB
testcase_57 AC 428 ms
48,760 KB
testcase_58 AC 83 ms
15,300 KB
testcase_59 AC 386 ms
37,280 KB
testcase_60 AC 128 ms
19,884 KB
testcase_61 AC 449 ms
49,240 KB
testcase_62 AC 428 ms
48,700 KB
testcase_63 AC 100 ms
16,288 KB
testcase_64 AC 375 ms
36,544 KB
testcase_65 AC 161 ms
21,516 KB
testcase_66 AC 54 ms
12,448 KB
testcase_67 AC 132 ms
20,420 KB
testcase_68 AC 66 ms
13,256 KB
testcase_69 AC 334 ms
34,184 KB
testcase_70 AC 228 ms
28,964 KB
testcase_71 AC 109 ms
16,724 KB
testcase_72 AC 63 ms
13,152 KB
testcase_73 AC 146 ms
20,792 KB
testcase_74 AC 101 ms
16,268 KB
testcase_75 AC 197 ms
23,552 KB
testcase_76 AC 130 ms
19,880 KB
testcase_77 AC 328 ms
33,860 KB
testcase_78 AC 228 ms
28,996 KB
testcase_79 AC 93 ms
15,828 KB
testcase_80 AC 78 ms
15,068 KB
testcase_81 AC 70 ms
13,592 KB
testcase_82 AC 268 ms
31,060 KB
testcase_83 AC 471 ms
49,604 KB
testcase_84 AC 472 ms
49,604 KB
testcase_85 AC 469 ms
49,604 KB
testcase_86 AC 468 ms
49,604 KB
testcase_87 AC 464 ms
49,604 KB
testcase_88 AC 464 ms
49,604 KB
testcase_89 AC 464 ms
49,604 KB
testcase_90 AC 465 ms
49,604 KB
testcase_91 AC 469 ms
49,604 KB
testcase_92 AC 464 ms
49,604 KB
testcase_93 AC 29 ms
10,240 KB
testcase_94 AC 30 ms
10,240 KB
testcase_95 AC 74 ms
20,964 KB
testcase_96 AC 88 ms
20,964 KB
testcase_97 AC 76 ms
21,496 KB
testcase_98 AC 260 ms
34,240 KB
testcase_99 AC 303 ms
35,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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")
0