結果

問題 No.1268 Fruit Rush 2
ユーザー mlihua09mlihua09
提出日時 2020-10-23 23:27:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 321 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 86,908 KB
実行使用メモリ 127,236 KB
最終ジャッジ日時 2023-09-28 18:42:45
合計ジャッジ時間 14,161 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,228 KB
testcase_01 AC 75 ms
71,228 KB
testcase_02 AC 74 ms
71,368 KB
testcase_03 AC 74 ms
71,240 KB
testcase_04 AC 74 ms
71,180 KB
testcase_05 AC 75 ms
71,256 KB
testcase_06 AC 75 ms
71,200 KB
testcase_07 AC 75 ms
71,184 KB
testcase_08 AC 75 ms
71,424 KB
testcase_09 AC 73 ms
71,420 KB
testcase_10 AC 74 ms
71,176 KB
testcase_11 AC 75 ms
71,228 KB
testcase_12 AC 76 ms
71,228 KB
testcase_13 AC 75 ms
71,432 KB
testcase_14 AC 75 ms
71,184 KB
testcase_15 AC 74 ms
71,168 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 725 ms
117,328 KB
testcase_27 AC 739 ms
116,964 KB
testcase_28 AC 716 ms
117,200 KB
testcase_29 AC 718 ms
117,104 KB
testcase_30 AC 726 ms
116,884 KB
testcase_31 AC 741 ms
115,260 KB
testcase_32 AC 738 ms
115,560 KB
testcase_33 AC 187 ms
127,236 KB
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

A = list(map(lambda x: [int(x), 1], input().split()))

ans = N

A.sort()

for i in range(N - 1):
    
    if A[i][0] == A[i + 1][0] - 1:
        
        ans += A[i][1]
        
        if i < N - 2 and A[i + 2][0] == A[i][0] + 2:
            
            A[i + 2][1] += A[i][1]
            
print(ans)
0