結果
| 問題 |
No.3126 Dual Query Problem
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-25 21:38:02 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 867 bytes |
| コンパイル時間 | 5,475 ms |
| コンパイル使用メモリ | 204,360 KB |
| 実行使用メモリ | 10,332 KB |
| 最終ジャッジ日時 | 2025-04-25 21:38:22 |
| 合計ジャッジ時間 | 13,511 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 WA * 3 |
ソースコード
import std;
void main () {
int N, Q;
readln.read(N, Q);
auto X = new int[](N);
foreach (i; 0 .. N) {
X[i] = readln.chomp.to!int;
}
auto Y = X.dup;
Y = Y.sort.uniq.array;
if (Q <= Y.length + N) {
writeln("No");
return;
}
writeln("Yes");
int[int] idof;
int xi = 0;
foreach (i; 0 .. Q) {
if (i < Y.length) {
writefln("1 %s %s", i + 2, Y[i]);
idof[Y[i]] = i + 2;
continue;
}
if (xi < N) {
writefln("2 %s", idof[X[xi]]);
xi++;
continue;
}
writefln("1 %s %s", 1, 1);
}
}
void read (T...) (string S, ref T args) {
import std.conv : to;
import std.array : split;
auto buf = S.split;
foreach (i, ref arg; args) {
arg = buf[i].to!(typeof(arg));
}
}