結果
| 問題 | 
                            No.8009 異なる数字の最大の範囲(勉強会用)
                             | 
                    
| ユーザー | 
                             zaki_chemtech
                         | 
                    
| 提出日時 | 2020-07-10 09:58:22 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 321 bytes | 
| コンパイル時間 | 234 ms | 
| コンパイル使用メモリ | 82,096 KB | 
| 実行使用メモリ | 97,344 KB | 
| 最終ジャッジ日時 | 2024-06-12 22:36:56 | 
| 合計ジャッジ時間 | 2,171 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 10 WA * 12 | 
ソースコード
n=int(input())
a = list(map(int,input().split()))
head = 0
check = {a[0]:0}
ans = 0
for tail in range(1,n):
    if a[tail] in check:
        ans = max(ans, tail-head)
        head = check[a[tail]]+1
        check[a[tail]] = tail
    else:
        check[a[tail]] = 1
    #print(ans)
ans = max(ans, n-head)
print(ans)
            
            
            
        
            
zaki_chemtech