結果

問題 No.1285 ゴミ捨て
ユーザー trineutrontrineutron
提出日時 2020-11-21 18:57:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 256 ms / 2,000 ms
コード長 187 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 10,500 KB
実行使用メモリ 13,136 KB
最終ジャッジ日時 2023-08-19 07:25:20
合計ジャッジ時間 3,652 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,784 KB
testcase_01 AC 14 ms
7,788 KB
testcase_02 AC 15 ms
7,804 KB
testcase_03 AC 13 ms
7,968 KB
testcase_04 AC 14 ms
7,852 KB
testcase_05 AC 14 ms
7,820 KB
testcase_06 AC 14 ms
7,764 KB
testcase_07 AC 251 ms
13,096 KB
testcase_08 AC 22 ms
8,308 KB
testcase_09 AC 118 ms
10,112 KB
testcase_10 AC 213 ms
12,444 KB
testcase_11 AC 191 ms
12,064 KB
testcase_12 AC 149 ms
10,896 KB
testcase_13 AC 153 ms
10,872 KB
testcase_14 AC 250 ms
12,888 KB
testcase_15 AC 173 ms
11,220 KB
testcase_16 AC 55 ms
9,112 KB
testcase_17 AC 55 ms
9,040 KB
testcase_18 AC 52 ms
8,844 KB
testcase_19 AC 104 ms
10,028 KB
testcase_20 AC 50 ms
8,792 KB
testcase_21 AC 68 ms
9,160 KB
testcase_22 AC 256 ms
13,136 KB
testcase_23 AC 254 ms
13,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = sorted([int(input()) for i in range(n)])
idx = 0
ans = 0
for i in range(n):
    while a[i] >= a[idx] + 2:
        idx += 1
    ans = max(ans, i - idx + 1)
print(ans)
0