結果

問題 No.2768 Password Crack
コンテスト
ユーザー Yukino DX.
提出日時 2024-06-03 21:31:24
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
RE  
実行時間 -
コード長 746 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 961 ms
コンパイル使用メモリ 196,168 KB
実行使用メモリ 30,436 KB
平均クエリ数 1.83
最終ジャッジ日時 2026-05-29 11:26:00
合計ジャッジ時間 7,196 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 1
other AC * 1 RE * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

use itertools::Itertools;
use proconio::input_interactive;

fn main() {
    input_interactive! {
        n:usize,
    }

    let mut t = vec![b'a'; n];
    for i in 0..n {
        let mut cnts = vec![0; 25];
        for j in 0..25 {
            t[i] = b'a' + j as u8;
            println!("? {}", t.iter().map(|ti| *ti as char).join(" "));
            input_interactive! {
                m:usize,
            }

            cnts[j] = m;
        }

        let sorted = (0..25).sorted_by_key(|&i| cnts[i]).collect::<Vec<_>>();
        if cnts[sorted[24]] != cnts[sorted[23]] {
            t[i] = b'a' + sorted[24] as u8;
        } else {
            t[i] = b'z';
        }
    }

    println!("! {}", t.iter().map(|ti| *ti as char).join(" "));
}
0