結果
| 問題 |
No.3009 Union-Find でつながろう!
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-15 23:24:57 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 485 bytes |
| コンパイル時間 | 339 ms |
| コンパイル使用メモリ | 81,728 KB |
| 実行使用メモリ | 66,884 KB |
| 最終ジャッジ日時 | 2025-04-15 23:26:14 |
| 合計ジャッジ時間 | 3,261 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 3 |
| other | RE * 27 |
ソースコード
n = int(input())
if n == 0:
print(0)
else:
a = list(map(int, input().split()))
last_occurrence = {}
max_len = 0
left = 0
for right in range(n):
current = a[right]
if current in last_occurrence and last_occurrence[current] >= left:
left = last_occurrence[current] + 1
last_occurrence[current] = right
current_len = right - left + 1
if current_len > max_len:
max_len = current_len
print(max_len)
lam6er