結果

問題 No.3126 Dual Query Problem
コンテスト
ユーザー norioc
提出日時 2026-05-27 00:15:49
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
WA  
実行時間 -
コード長 1,084 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,849 ms
コンパイル使用メモリ 199,412 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-05-27 00:16:09
合計ジャッジ時間 13,237 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 21 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#![allow(non_snake_case, unused_imports)]

use std::collections::{HashMap, HashSet};
use proconio::{input, marker::Usize1, marker::Chars};
use itertools::Itertools;

#[allow(unused_macros)]
macro_rules! d {
    ( $( $x:expr ),* $(,)? ) => {
        eprintln!(
            concat!( $( stringify!($x), "={:?} " ),* ),
            $( $x ),*
        );
    };
}

#[allow(dead_code)]
fn yn(b: bool) -> &'static str {
    if b { "Yes" } else { "No" }
}

fn main() {
    input! {
        N: usize,
        Q: usize,
        X: [i64; N],
    }

    let d: HashMap<i64, usize> = X.iter().copied().collect::<HashSet<_>>()
        .into_iter()
        .enumerate()
        .map(|(i, x)| (x, i))
        .collect();

    let cnt = d.len() + N;
    if cnt > Q {
        println!("No");
        return;
    }

    println!("Yes");
    let mut used = HashSet::new();
    for x in X {
        if !used.contains(&x) {
            println!("1 {} {}", d[&x]+1, x);
            used.insert(x);
        }

        println!("2 {}", d[&x]+1)
    }

    for _ in 0..Q-cnt {
        println!("1 1 0")
    }
}
0