結果

問題 No.1208 anti primenumber game
ユーザー nebukuro09nebukuro09
提出日時 2020-08-30 14:16:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 542 ms / 2,000 ms
コード長 443 bytes
コンパイル時間 404 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 60,236 KB
最終ジャッジ日時 2024-04-27 07:25:13
合計ジャッジ時間 16,401 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,880 KB
testcase_01 AC 29 ms
10,752 KB
testcase_02 AC 29 ms
10,752 KB
testcase_03 AC 29 ms
10,752 KB
testcase_04 AC 30 ms
10,880 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 30 ms
10,752 KB
testcase_07 AC 30 ms
10,752 KB
testcase_08 AC 29 ms
10,752 KB
testcase_09 AC 30 ms
10,752 KB
testcase_10 AC 29 ms
10,752 KB
testcase_11 AC 30 ms
10,752 KB
testcase_12 AC 29 ms
10,752 KB
testcase_13 AC 30 ms
10,880 KB
testcase_14 AC 29 ms
10,880 KB
testcase_15 AC 363 ms
50,212 KB
testcase_16 AC 305 ms
31,400 KB
testcase_17 AC 352 ms
50,340 KB
testcase_18 AC 311 ms
31,528 KB
testcase_19 AC 378 ms
53,416 KB
testcase_20 AC 381 ms
53,540 KB
testcase_21 AC 431 ms
43,612 KB
testcase_22 AC 455 ms
49,764 KB
testcase_23 AC 439 ms
50,216 KB
testcase_24 AC 542 ms
51,196 KB
testcase_25 AC 515 ms
51,120 KB
testcase_26 AC 526 ms
60,192 KB
testcase_27 AC 533 ms
60,236 KB
testcase_28 AC 523 ms
53,004 KB
testcase_29 AC 526 ms
60,236 KB
testcase_30 AC 373 ms
52,780 KB
testcase_31 AC 364 ms
53,412 KB
testcase_32 AC 358 ms
50,216 KB
testcase_33 AC 456 ms
53,028 KB
testcase_34 AC 473 ms
50,216 KB
testcase_35 AC 459 ms
50,216 KB
testcase_36 AC 367 ms
36,420 KB
testcase_37 AC 466 ms
53,412 KB
testcase_38 AC 479 ms
51,508 KB
testcase_39 AC 489 ms
57,984 KB
testcase_40 AC 526 ms
59,176 KB
testcase_41 AC 383 ms
54,316 KB
testcase_42 AC 477 ms
53,884 KB
testcase_43 AC 464 ms
53,508 KB
testcase_44 AC 439 ms
53,500 KB
testcase_45 AC 419 ms
47,468 KB
testcase_46 AC 376 ms
48,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

sm = [0 for _ in range(n+1)]
for i in range(n-1, -1, -1):
    sm[i] = sm[i+1] - m + a[i]

dp = [[0, 0] for i in range(n+1)]

for i in range(n-1, -1, -1):
    if a[i] == 1:
        dp[i][0] = dp[i+1][1] + 1 - m
    else:
        dp[i][0] = max(dp[i+1][0] + a[i] - 1, dp[i+1][1] + a[i] - m)
    dp[i][1] = sm[i] - dp[i][0]

print('First' if dp[0][0] > dp[0][1] else 'Second')
0