結果
| 問題 | 
                            No.2126 MEX Game
                             | 
                    
| コンテスト | |
| ユーザー | 
                             とりゐ
                         | 
                    
| 提出日時 | 2022-11-18 21:26:05 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 65 ms / 2,000 ms | 
| コード長 | 296 bytes | 
| コンパイル時間 | 237 ms | 
| コンパイル使用メモリ | 81,920 KB | 
| 実行使用メモリ | 81,664 KB | 
| 最終ジャッジ日時 | 2024-09-20 01:51:23 | 
| 合計ジャッジ時間 | 2,590 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 27 | 
ソースコード
m=10**5+10
n=int(input())
a=list(map(int,input().split()))
mx=max(a)
a.remove(mx)
cnt=[0]*m
for i in a:
  cnt[i]+=1
if max(cnt)>=3:
  cnt[mx]+=1
use=0
flag=0
for i in range(m):
  if cnt[i]==0:
    print(i)
    exit()
  if cnt[i]==1:
    if flag:
      print(i)
      exit()
    else:
      flag=1
            
            
            
        
            
とりゐ