結果

問題 No.1285 ゴミ捨て
ユーザー shotoyooshotoyoo
提出日時 2020-11-13 23:42:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 325 bytes
コンパイル時間 226 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 77,440 KB
最終ジャッジ日時 2024-05-06 14:33:59
合計ジャッジ時間 2,553 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,096 KB
testcase_01 AC 39 ms
51,840 KB
testcase_02 AC 38 ms
52,352 KB
testcase_03 AC 38 ms
51,968 KB
testcase_04 AC 38 ms
51,840 KB
testcase_05 AC 38 ms
51,968 KB
testcase_06 AC 37 ms
51,840 KB
testcase_07 AC 81 ms
77,440 KB
testcase_08 AC 47 ms
61,824 KB
testcase_09 AC 65 ms
75,904 KB
testcase_10 AC 80 ms
76,940 KB
testcase_11 AC 78 ms
76,672 KB
testcase_12 AC 71 ms
76,452 KB
testcase_13 AC 70 ms
75,776 KB
testcase_14 AC 84 ms
76,928 KB
testcase_15 AC 74 ms
76,032 KB
testcase_16 AC 54 ms
67,328 KB
testcase_17 AC 53 ms
67,456 KB
testcase_18 AC 53 ms
66,560 KB
testcase_19 AC 60 ms
74,112 KB
testcase_20 AC 54 ms
66,048 KB
testcase_21 AC 56 ms
68,608 KB
testcase_22 AC 85 ms
77,128 KB
testcase_23 AC 84 ms
76,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")

n = int(input())
a = [int(input()) for _ in range(n)]
a.sort()
ans = 0
j = 0
for i in range(n):
    while j+1<n and a[j+1]<=a[i]+1:
        j += 1
    ans = max(ans, j-i+1)
print(ans)
0