結果
問題 |
No.2779 Don't make Pair
|
ユーザー |
|
提出日時 | 2025-02-19 11:38:31 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 128 ms / 2,000 ms |
コード長 | 411 bytes |
コンパイル時間 | 335 ms |
コンパイル使用メモリ | 81,792 KB |
実行使用メモリ | 102,352 KB |
最終ジャッジ日時 | 2025-02-19 11:38:36 |
合計ジャッジ時間 | 4,555 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 24 |
ソースコード
from collections import defaultdict n=int(input()) A=list(map(int,input().split())) D=defaultdict(list) for i,j in enumerate(A): D[j].append(i+1) l,r=1,n-1 for I in D.values(): if len(I)>2: print(0) print() exit() elif len(I)==2: l=max(l,min(I)) r=min(r,max(I)-1) if r-l+1<=0: print(0) print() exit() print(r-l+1) print(*[i for i in range(l,r+1)])