結果
問題 | No.2779 Don't make Pair |
ユーザー |
![]() |
提出日時 | 2024-06-07 22:33:15 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 497 bytes |
コンパイル時間 | 182 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 104,704 KB |
最終ジャッジ日時 | 2024-12-26 08:43:33 |
合計ジャッジ時間 | 4,223 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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=len(A) 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==len(A): 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)