結果
問題 |
No.2779 Don't make Pair
|
ユーザー |
![]() |
提出日時 | 2024-06-07 22:44:40 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 486 bytes |
コンパイル時間 | 382 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 104,960 KB |
最終ジャッジ日時 | 2024-12-26 09:06:45 |
合計ジャッジ時間 | 5,256 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 WA * 1 |
other | AC * 20 WA * 4 |
ソースコード
from collections import defaultdict dp=defaultdict(int) f=defaultdict(int) indf=-1 N=int(input()) A=list(map(int,input().split())) ind2=N for a in range(N): if dp[A[a]]==2: print(0) exit() elif dp[A[a]]==1: indf=max(indf,f[A[a]]) ind2=min(ind2,a) elif dp[A[a]]==0: f[A[a]]=a dp[A[a]]+=1 if ind2==N: print(N-1) print(*[i+1 for i in range(N-1)]) exit() ans= [i+1 for i in range(indf,ind2)] print(len(ans)) print(*ans)