結果

問題 No.1268 Fruit Rush 2
ユーザー 👑 KazunKazun
提出日時 2020-10-23 22:28:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 311 ms / 2,000 ms
コード長 356 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 86,952 KB
実行使用メモリ 170,096 KB
最終ジャッジ日時 2023-09-28 16:32:20
合計ジャッジ時間 7,909 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,632 KB
testcase_01 AC 73 ms
71,532 KB
testcase_02 AC 77 ms
71,384 KB
testcase_03 AC 75 ms
71,224 KB
testcase_04 AC 76 ms
71,300 KB
testcase_05 AC 78 ms
71,268 KB
testcase_06 AC 76 ms
71,076 KB
testcase_07 AC 75 ms
71,360 KB
testcase_08 AC 77 ms
71,376 KB
testcase_09 AC 78 ms
71,072 KB
testcase_10 AC 77 ms
71,440 KB
testcase_11 AC 77 ms
71,304 KB
testcase_12 AC 76 ms
71,108 KB
testcase_13 AC 77 ms
71,436 KB
testcase_14 AC 76 ms
71,480 KB
testcase_15 AC 76 ms
71,376 KB
testcase_16 AC 232 ms
123,436 KB
testcase_17 AC 198 ms
117,980 KB
testcase_18 AC 212 ms
118,252 KB
testcase_19 AC 212 ms
118,332 KB
testcase_20 AC 207 ms
117,968 KB
testcase_21 AC 210 ms
118,184 KB
testcase_22 AC 225 ms
123,172 KB
testcase_23 AC 227 ms
123,304 KB
testcase_24 AC 219 ms
118,252 KB
testcase_25 AC 197 ms
117,852 KB
testcase_26 AC 180 ms
131,144 KB
testcase_27 AC 177 ms
130,980 KB
testcase_28 AC 173 ms
130,804 KB
testcase_29 AC 176 ms
130,948 KB
testcase_30 AC 179 ms
130,880 KB
testcase_31 AC 311 ms
138,072 KB
testcase_32 AC 310 ms
138,144 KB
testcase_33 AC 204 ms
169,996 KB
testcase_34 AC 175 ms
138,104 KB
testcase_35 AC 193 ms
170,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Memo={}
def f(x):
    if x in Memo:
        return Memo[x]

    k=0
    y=x
    while y+2 in B:
        k+=1
        y+=2

    for i in range(k+1):
        Memo[y]=i
        y-=2

    return Memo[x]

N=int(input())
A=list(map(int,input().split()))
B=set(A)

X=N
for a in A:
    if a+1 in B:
        X+=1
    else:
        continue

    X+=f(a+1)

print(X)
0