結果
問題 |
No.2779 Don't make Pair
|
ユーザー |
👑 |
提出日時 | 2024-06-07 22:09:49 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 391 bytes |
コンパイル時間 | 373 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 111,368 KB |
最終ジャッジ日時 | 2024-12-26 08:15:06 |
合計ジャッジ時間 | 5,724 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 RE * 4 |
other | AC * 4 RE * 20 |
ソースコード
from collections import Counter n = int(input()) a = [int(x) for x in input().split()] cnt = Counter(a) if any(cnt[x] >= 3 for x in a): print("0\n") exit() left = {} right = {} for i in range(n): left[~a[i]] = i right[a[i]] = i p = -1 q = n for x in a: if left[x] == right[x]: continue p = max(left[x], p) q = min(right[x], q) r = range(p + 1, q) print(len(r)) print(*r)