結果

問題 No.1268 Fruit Rush 2
ユーザー mkawa2mkawa2
提出日時 2020-11-09 15:43:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 281 ms / 2,000 ms
コード長 1,089 bytes
コンパイル時間 115 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 60,384 KB
最終ジャッジ日時 2023-09-29 22:07:20
合計ジャッジ時間 8,587 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,584 KB
testcase_01 AC 18 ms
8,748 KB
testcase_02 AC 19 ms
8,792 KB
testcase_03 AC 19 ms
8,692 KB
testcase_04 AC 19 ms
8,652 KB
testcase_05 AC 18 ms
8,724 KB
testcase_06 AC 19 ms
8,740 KB
testcase_07 AC 18 ms
8,612 KB
testcase_08 AC 18 ms
8,648 KB
testcase_09 AC 18 ms
8,772 KB
testcase_10 AC 18 ms
8,596 KB
testcase_11 AC 18 ms
8,664 KB
testcase_12 AC 18 ms
8,736 KB
testcase_13 AC 18 ms
8,692 KB
testcase_14 AC 18 ms
8,752 KB
testcase_15 AC 18 ms
8,544 KB
testcase_16 AC 202 ms
35,128 KB
testcase_17 AC 173 ms
25,048 KB
testcase_18 AC 189 ms
34,224 KB
testcase_19 AC 190 ms
34,296 KB
testcase_20 AC 176 ms
24,952 KB
testcase_21 AC 172 ms
24,968 KB
testcase_22 AC 204 ms
35,104 KB
testcase_23 AC 213 ms
35,352 KB
testcase_24 AC 185 ms
34,356 KB
testcase_25 AC 180 ms
24,904 KB
testcase_26 AC 280 ms
36,380 KB
testcase_27 AC 281 ms
36,392 KB
testcase_28 AC 279 ms
36,300 KB
testcase_29 AC 275 ms
36,264 KB
testcase_30 AC 275 ms
36,436 KB
testcase_31 AC 257 ms
45,048 KB
testcase_32 AC 262 ms
45,092 KB
testcase_33 AC 227 ms
50,468 KB
testcase_34 AC 233 ms
55,052 KB
testcase_35 AC 257 ms
60,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from operator import itemgetter
from itertools import *
from bisect import *
from collections import *
from heapq import *
import sys

sys.setrecursionlimit(10**6)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def MI(): return map(int, sys.stdin.buffer.readline().split())
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MI1(): return map(int1, sys.stdin.buffer.readline().split())
def LI1(): return list(map(int1, sys.stdin.buffer.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def BI(): return sys.stdin.buffer.readline().rstrip()
def SI(): return sys.stdin.buffer.readline().rstrip().decode()
def inval(ni, nj, h, w):
    if ni < 0 or ni >= h or nj < 0 or nj >= w: return True
    return False
dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
inf = 10**16

n = II()
aa = LI()

dp=defaultdict(int)
aa.sort()
for a in aa:
    dp[a]+=1
    if a-1 in dp:dp[a+1]=dp[a-1]

ans=sum(dp.values())
print(ans)
0