結果
| 問題 | 
                            No.8009 異なる数字の最大の範囲(勉強会用)
                             | 
                    
| ユーザー | 
                             kbys
                         | 
                    
| 提出日時 | 2020-07-20 23:33:51 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 291 bytes | 
| コンパイル時間 | 294 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 25,924 KB | 
| 最終ジャッジ日時 | 2024-06-12 22:37:02 | 
| 合計ジャッジ時間 | 1,949 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 7 WA * 15 | 
ソースコード
n = int(input())
A = list(map(int,input().split()))
ans = 0
left = 0
ind = {}
for i,a in enumerate(A):
    if a not in ind:
        ind[a] = i
    else:
        length = i - ind[a]
        ans = max(ans, length)
        left = ind[a] + 1
        ind[a] = i
ans = max(ans, n-left)
print(ans)
            
            
            
        
            
kbys