結果
問題 |
No.3009 Union-Find でつながろう!
|
ユーザー |
![]() |
提出日時 | 2025-06-12 19:57:20 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 369 bytes |
コンパイル時間 | 445 ms |
コンパイル使用メモリ | 82,104 KB |
実行使用メモリ | 66,992 KB |
最終ジャッジ日時 | 2025-06-12 19:58:53 |
合計ジャッジ時間 | 3,719 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 27 |
ソースコード
n = int(input()) if n == 0: print(0) exit() a = list(map(int, input().split())) max_len = 0 left = 0 seen = dict() for right in range(n): num = a[right] if num in seen and seen[num] >= left: left = seen[num] + 1 seen[num] = right current_len = right - left + 1 if current_len > max_len: max_len = current_len print(max_len)