結果
| 問題 | 
                            No.1268 Fruit Rush 2
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-10-23 23:27:05 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 321 bytes | 
| コンパイル時間 | 263 ms | 
| コンパイル使用メモリ | 82,280 KB | 
| 実行使用メモリ | 127,392 KB | 
| 最終ジャッジ日時 | 2024-07-21 13:23:22 | 
| 合計ジャッジ時間 | 13,407 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 21 WA * 12 | 
ソースコード
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)