結果

問題 No.1285 ゴミ捨て
ユーザー shotoyooshotoyoo
提出日時 2020-11-13 23:42:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 107 ms / 2,000 ms
コード長 325 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 87,320 KB
実行使用メモリ 78,268 KB
最終ジャッジ日時 2023-08-19 07:19:31
合計ジャッジ時間 3,355 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
71,492 KB
testcase_01 AC 60 ms
71,492 KB
testcase_02 AC 60 ms
71,268 KB
testcase_03 AC 60 ms
71,488 KB
testcase_04 AC 59 ms
71,480 KB
testcase_05 AC 59 ms
71,332 KB
testcase_06 AC 65 ms
71,420 KB
testcase_07 AC 107 ms
77,956 KB
testcase_08 AC 70 ms
76,700 KB
testcase_09 AC 81 ms
77,288 KB
testcase_10 AC 93 ms
77,788 KB
testcase_11 AC 91 ms
78,248 KB
testcase_12 AC 84 ms
77,540 KB
testcase_13 AC 83 ms
77,596 KB
testcase_14 AC 94 ms
77,892 KB
testcase_15 AC 86 ms
77,660 KB
testcase_16 AC 74 ms
76,600 KB
testcase_17 AC 75 ms
76,780 KB
testcase_18 AC 73 ms
76,556 KB
testcase_19 AC 78 ms
77,428 KB
testcase_20 AC 71 ms
76,332 KB
testcase_21 AC 76 ms
76,812 KB
testcase_22 AC 101 ms
78,228 KB
testcase_23 AC 100 ms
78,268 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