結果

問題 No.1285 ゴミ捨て
ユーザー akanayaakanaya
提出日時 2020-11-23 10:37:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 276 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 10,716 KB
実行使用メモリ 20,140 KB
最終ジャッジ日時 2023-08-19 07:26:03
合計ジャッジ時間 3,967 ms
ジャッジサーバーID
(参考情報)
judge14 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,556 KB
testcase_01 AC 16 ms
8,576 KB
testcase_02 AC 16 ms
8,632 KB
testcase_03 AC 17 ms
8,508 KB
testcase_04 AC 17 ms
8,444 KB
testcase_05 AC 17 ms
8,544 KB
testcase_06 AC 17 ms
8,492 KB
testcase_07 AC 246 ms
19,820 KB
testcase_08 AC 25 ms
8,988 KB
testcase_09 AC 115 ms
11,904 KB
testcase_10 AC 223 ms
15,532 KB
testcase_11 AC 200 ms
15,232 KB
testcase_12 AC 152 ms
14,532 KB
testcase_13 AC 151 ms
14,424 KB
testcase_14 AC 240 ms
19,696 KB
testcase_15 AC 174 ms
14,816 KB
testcase_16 AC 63 ms
10,176 KB
testcase_17 AC 64 ms
10,308 KB
testcase_18 AC 60 ms
10,124 KB
testcase_19 AC 111 ms
11,756 KB
testcase_20 AC 56 ms
10,052 KB
testcase_21 AC 75 ms
11,304 KB
testcase_22 AC 272 ms
20,140 KB
testcase_23 AC 276 ms
19,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter, defaultdict, deque

n = int(input())
ary = [None] * n
for i in range(n):
    ary[i] = (int(input()))

c = Counter(ary)

ks = sorted(c.keys())

result = 1
for i in range(len(ks) - 1):
    if ks[i + 1] - ks[i] == 1:
        if c[ks[i + 1]] + c[ks[i]]> result:
            result = c[ks[i + 1]] + c[ks[i]]

print(result)
0