結果
| 問題 |
No.1268 Fruit Rush 2
|
| コンテスト | |
| ユーザー |
stnkien
|
| 提出日時 | 2020-10-23 23:57:06 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 241 bytes |
| コンパイル時間 | 222 ms |
| コンパイル使用メモリ | 82,780 KB |
| 実行使用メモリ | 174,196 KB |
| 最終ジャッジ日時 | 2024-07-21 13:57:42 |
| 合計ジャッジ時間 | 5,917 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 12 |
ソースコード
from collections import defaultdict
N = int(input())
*A, = map(int, input().split())
A.sort()
S = set()
dp = defaultdict(int)
for a in A:
if a-1 in S or a-1 in dp:
dp[a+1] = 1 + dp[a-1]
S.add(a)
print(sum(dp.values()) + N)
stnkien