結果

問題 No.954 Result
ユーザー lloyzlloyz
提出日時 2023-05-12 00:04:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 573 bytes
コンパイル時間 320 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 71,376 KB
最終ジャッジ日時 2023-08-18 14:03:21
合計ジャッジ時間 4,538 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,212 KB
testcase_01 AC 64 ms
71,368 KB
testcase_02 AC 64 ms
70,944 KB
testcase_03 AC 66 ms
71,128 KB
testcase_04 AC 66 ms
71,364 KB
testcase_05 AC 66 ms
71,184 KB
testcase_06 AC 62 ms
71,296 KB
testcase_07 AC 65 ms
71,316 KB
testcase_08 AC 63 ms
71,368 KB
testcase_09 AC 61 ms
71,048 KB
testcase_10 AC 65 ms
71,068 KB
testcase_11 AC 65 ms
71,332 KB
testcase_12 AC 64 ms
71,180 KB
testcase_13 AC 63 ms
71,292 KB
testcase_14 AC 64 ms
71,252 KB
testcase_15 AC 64 ms
71,120 KB
testcase_16 AC 66 ms
71,376 KB
testcase_17 AC 65 ms
71,220 KB
testcase_18 AC 65 ms
71,372 KB
testcase_19 AC 65 ms
71,360 KB
testcase_20 AC 64 ms
71,080 KB
testcase_21 AC 66 ms
71,244 KB
testcase_22 AC 66 ms
71,240 KB
testcase_23 AC 67 ms
71,180 KB
testcase_24 AC 65 ms
71,172 KB
testcase_25 AC 67 ms
71,148 KB
testcase_26 AC 67 ms
71,316 KB
testcase_27 AC 67 ms
71,348 KB
testcase_28 AC 66 ms
71,080 KB
testcase_29 AC 66 ms
71,088 KB
testcase_30 AC 64 ms
71,168 KB
testcase_31 AC 66 ms
71,272 KB
testcase_32 AC 64 ms
71,368 KB
testcase_33 AC 64 ms
71,312 KB
testcase_34 AC 65 ms
71,284 KB
testcase_35 AC 66 ms
71,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_right

DP = [0 for _ in range(75)]
DP[0] = DP[1] = 1
for i in range(2, 75):
    DP[i] = DP[i - 1] + DP[i - 2]

A = [int(input()) for _ in range(5)]
if A[4] == 1 and A[3] == 1:
    if A[2] != 2:
        print(2)
    elif A[1] != 3:
        print(3)
    elif A[0] != 5:
        print(4)
    else:
        print(5)
    exit()
ans = 0
pre_idx = -1
for i in range(4, -1, -1):
    idx = bisect_right(DP, A[i]) - 1
    if DP[idx] != A[i]:
        break
    if pre_idx != -1 and idx != pre_idx + 1:
        break
    ans += 1
    pre_idx = idx
print(ans)
0