結果
| 問題 |
No.3009 Union-Find でつながろう!
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 14:53:28 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 442 bytes |
| コンパイル時間 | 241 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 65,408 KB |
| 最終ジャッジ日時 | 2025-06-12 14:56:26 |
| 合計ジャッジ時間 | 3,572 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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
L = 0
for R in range(len(a)):
num = a[R]
if num in last_occurrence and last_occurrence[num] >= L:
L = last_occurrence[num] + 1
last_occurrence[num] = R
current_len = R - L + 1
if current_len > max_len:
max_len = current_len
print(max_len)
gew1fw