結果
問題 | No.2779 Don't make Pair |
ユーザー |
|
提出日時 | 2024-06-07 21:37:00 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 123 ms / 2,000 ms |
コード長 | 345 bytes |
コンパイル時間 | 181 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 102,364 KB |
最終ジャッジ日時 | 2024-12-26 07:20:34 |
合計ジャッジ時間 | 3,496 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 24 |
ソースコード
from collections import defaultdictn = int(input())a = list(map(int, input().split()))m = 1M = n - 1d = defaultdict(list)for i in range(n):d[a[i]].append(i)for i, j in d.items():if len(j) > 2:print(0)exit(print())if len(j) == 2:m = max(m, j[0] + 1)M = min(M, j[1])ans = list(range(m, M + 1))print(len(ans))print(*ans)