結果

問題 No.3126 Dual Query Problem
ユーザー tkykwtnb
提出日時 2025-04-25 21:45:11
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 455 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 82,044 KB
実行使用メモリ 92,776 KB
最終ジャッジ日時 2025-04-25 21:45:29
合計ジャッジ時間 9,063 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 18 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
N,Q=map(int,input().split())
X=[int(input()) for _ in range(N)]
D=defaultdict(int)
A=defaultdict(int)
Xcnt=0
for x in X:
    if x>0:Xcnt+=1
    D[x]+=1
if Xcnt>(Q-N+Xcnt)//2:exit(print("No"))
cnt=0
i=0
while i<N:
    if X[i]==0:
        print(f"2 0");cnt+=1
    else:
        if A[X[i]]==0:
            print(f"1 {X[i]} {X[i]}");cnt+=1
        print(f"2 {X[i]}");cnt+=1
    i+=1
if cnt<Q:
    print(f"1 1 1")
    cnt+=1
0