結果
| 問題 |
No.1268 Fruit Rush 2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-10-31 18:18:53 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 180 ms / 2,000 ms |
| コード長 | 497 bytes |
| コンパイル時間 | 435 ms |
| コンパイル使用メモリ | 82,580 KB |
| 実行使用メモリ | 139,100 KB |
| 最終ジャッジ日時 | 2024-07-22 05:07:13 |
| 合計ジャッジ時間 | 5,534 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 33 |
ソースコード
n = int(input())
a = list(map(int,input().split()))
a.sort()
dic = {}
for i in range(n):
dic[a[i]] = i
ans = n
used = [0]*n
for i in range(1,n):
if used[i]:
continue
used[i] = 1
if a[i] == a[i-1]+1:
count = 1
s = 1
k = a[i]
ans += 1
while k+count*2 in dic:
ans += s
if k+count*2-1 in dic:
s += 1
ans += 1
used[dic[k+count*2]] = 1
count += 1
print(ans)