結果

問題 No.1268 Fruit Rush 2
ユーザー chineristACchineristAC
提出日時 2020-10-24 01:37:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 172 ms / 2,000 ms
コード長 340 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 110,268 KB
最終ジャッジ日時 2023-09-28 19:58:18
合計ジャッジ時間 6,507 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,328 KB
testcase_01 AC 77 ms
71,468 KB
testcase_02 AC 77 ms
71,424 KB
testcase_03 AC 75 ms
71,360 KB
testcase_04 AC 75 ms
71,108 KB
testcase_05 AC 76 ms
71,464 KB
testcase_06 AC 77 ms
71,144 KB
testcase_07 AC 75 ms
71,136 KB
testcase_08 AC 76 ms
71,068 KB
testcase_09 AC 74 ms
71,308 KB
testcase_10 AC 76 ms
71,052 KB
testcase_11 AC 75 ms
71,196 KB
testcase_12 AC 76 ms
71,480 KB
testcase_13 AC 77 ms
71,208 KB
testcase_14 AC 75 ms
71,252 KB
testcase_15 AC 76 ms
71,260 KB
testcase_16 AC 156 ms
103,156 KB
testcase_17 AC 142 ms
98,976 KB
testcase_18 AC 144 ms
99,848 KB
testcase_19 AC 144 ms
99,576 KB
testcase_20 AC 142 ms
99,580 KB
testcase_21 AC 142 ms
99,208 KB
testcase_22 AC 152 ms
102,784 KB
testcase_23 AC 150 ms
102,928 KB
testcase_24 AC 144 ms
100,000 KB
testcase_25 AC 143 ms
99,152 KB
testcase_26 AC 172 ms
102,952 KB
testcase_27 AC 169 ms
102,936 KB
testcase_28 AC 170 ms
102,900 KB
testcase_29 AC 172 ms
102,840 KB
testcase_30 AC 171 ms
102,940 KB
testcase_31 AC 162 ms
110,268 KB
testcase_32 AC 164 ms
110,116 KB
testcase_33 AC 142 ms
108,908 KB
testcase_34 AC 129 ms
109,044 KB
testcase_35 AC 140 ms
109,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

A = list(map(int,input().split()))
A.sort()
data = [1 for i in range(N)]
for i in range(N-2,-1,-1):
    if i+1<N and A[i+1]==A[i]+2:
        data[i] += data[i+1]
    elif i+2<N and A[i+2]==A[i]+2:
        data[i] += data[i+2]

res = N
for i in range(N-2,-1,-1):
    if A[i+1]==A[i]+1:
        res += data[i+1]

print(res)
0