結果

問題 No.2779 Don't make Pair
ユーザー あじゃじゃあじゃじゃ
提出日時 2024-06-07 22:29:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 441 bytes
コンパイル時間 412 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 107,392 KB
最終ジャッジ日時 2024-12-26 08:38:44
合計ジャッジ時間 4,696 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 2
other AC * 3 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
dp=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,dp[A[a]])
        ind2=min(ind2,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+1,ind2)] 
print(len(ans))
print(*ans)
0