結果
問題 | No.2779 Don't make Pair |
ユーザー |
![]() |
提出日時 | 2024-06-07 21:44:26 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 149 ms / 2,000 ms |
コード長 | 478 bytes |
コンパイル時間 | 181 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 103,808 KB |
最終ジャッジ日時 | 2024-12-26 07:33:54 |
合計ジャッジ時間 | 4,088 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 24 |
ソースコード
#N,K=map(int, input().split())#A=list(map(int, input().split()))N=int(input())A=list(map(int, input().split()))D={}for i in range(N):a=A[i]if a not in D:D[a]=[]D[a].append(i)l,r=1,N-1ans=[]for d in D:if len(D[d])>2:print(0)print(*ans)exit()if len(D[d])==2:ll,rr=D[d][0]+1,D[d][1]l=max(l,ll);r=min(r,rr)if l<=r:ans=[i for i in range(l,r+1)]print(len(ans))print(*ans)else:print(0)ans=[]print(*ans)