結果

問題 No.1268 Fruit Rush 2
ユーザー nehan_der_thalnehan_der_thal
提出日時 2020-10-23 22:38:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 171 ms / 2,000 ms
コード長 672 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 87,172 KB
実行使用メモリ 110,548 KB
最終ジャッジ日時 2023-09-28 16:46:20
合計ジャッジ時間 6,779 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
71,368 KB
testcase_01 AC 79 ms
71,188 KB
testcase_02 AC 80 ms
71,320 KB
testcase_03 AC 77 ms
71,192 KB
testcase_04 AC 77 ms
71,360 KB
testcase_05 AC 79 ms
71,456 KB
testcase_06 AC 77 ms
71,420 KB
testcase_07 AC 75 ms
71,328 KB
testcase_08 AC 77 ms
71,336 KB
testcase_09 AC 78 ms
71,292 KB
testcase_10 AC 78 ms
71,172 KB
testcase_11 AC 77 ms
71,200 KB
testcase_12 AC 77 ms
71,312 KB
testcase_13 AC 77 ms
71,448 KB
testcase_14 AC 77 ms
71,256 KB
testcase_15 AC 79 ms
71,364 KB
testcase_16 AC 153 ms
102,928 KB
testcase_17 AC 143 ms
98,920 KB
testcase_18 AC 146 ms
99,560 KB
testcase_19 AC 146 ms
99,220 KB
testcase_20 AC 144 ms
99,332 KB
testcase_21 AC 144 ms
98,904 KB
testcase_22 AC 152 ms
102,704 KB
testcase_23 AC 151 ms
102,548 KB
testcase_24 AC 145 ms
99,856 KB
testcase_25 AC 146 ms
99,056 KB
testcase_26 AC 171 ms
102,752 KB
testcase_27 AC 171 ms
102,604 KB
testcase_28 AC 170 ms
102,612 KB
testcase_29 AC 170 ms
102,596 KB
testcase_30 AC 170 ms
102,756 KB
testcase_31 AC 163 ms
110,548 KB
testcase_32 AC 161 ms
110,240 KB
testcase_33 AC 147 ms
108,800 KB
testcase_34 AC 123 ms
108,728 KB
testcase_35 AC 142 ms
108,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#F = [1, 1]
#for _ in range(10000):
#    F.append(F[-2]+F[-1])
#fs = set(F)

N, = map(int, input().split())
X = list(map(int, input().split()))
X.append(2*10**18)
X.append(2*10**18)
dp = [1] * (N+2)
R = 0

X.sort()
for i in range(N-1, -1, -1):
    if X[i+1] == X[i] + 2:
        dp[i] = dp[i+1] + 1
    if X[i+2] == X[i] + 2:
        dp[i] = dp[i+2] + 1
    if X[i+1] == X[i] + 1:
        R += dp[i+1]+1
    else:
        R += 1
#print(X)
#print(dp)
print(R)

#
#for i in range(2**N):
#    R = 0
#    Y = []
#    for j in range(i):
#        i, m = divmod(i, 2)
#        if m:
#            R += F[X[j]]
#            Y.append(X[j])
#    if R in fs:
#        print(R, Y)
#
#
0