結果
| 問題 | 
                            No.2768 Password Crack
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2024-06-03 21:35:51 | 
| 言語 | Rust  (1.83.0 + proconio)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 121 ms / 2,000 ms | 
| コード長 | 781 bytes | 
| コンパイル時間 | 14,261 ms | 
| コンパイル使用メモリ | 378,640 KB | 
| 実行使用メモリ | 25,488 KB | 
| 平均クエリ数 | 1785.17 | 
| 最終ジャッジ日時 | 2024-12-23 10:43:00 | 
| 合計ジャッジ時間 | 19,153 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 29 | 
ソースコード
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 = (0..25).map(|i| (0, i)).collect::<Vec<_>>();
        for j in 0..25 {
            t[i] = b'a' + j as u8;
            print!("? ");
            for ti in t.iter() {
                print!("{}", *ti as char);
            }
            println!();
            input_interactive! {
                m:usize,
            }
            cnts[j].0 = m;
        }
        cnts.sort();
        if cnts[24].0 != cnts[23].0 {
            t[i] = b'a' + cnts[24].1 as u8;
        } else {
            t[i] = b'z';
        }
    }
    print!("! ");
    for ti in t {
        print!("{}", ti as char);
    }
    println!();
}