結果

問題 No.934 Explosive energy drink
ユーザー koba-e964koba-e964
提出日時 2020-02-29 00:01:16
言語 Rust
(1.77.0)
結果
AC  
実行時間 340 ms / 2,000 ms
コード長 1,728 bytes
コンパイル時間 2,272 ms
コンパイル使用メモリ 148,600 KB
実行使用メモリ 24,384 KB
平均クエリ数 709.58
最終ジャッジ日時 2023-09-23 19:46:35
合計ジャッジ時間 7,506 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
23,832 KB
testcase_01 AC 339 ms
23,640 KB
testcase_02 AC 26 ms
23,964 KB
testcase_03 AC 173 ms
23,388 KB
testcase_04 AC 340 ms
23,832 KB
testcase_05 AC 26 ms
24,192 KB
testcase_06 AC 26 ms
23,832 KB
testcase_07 AC 26 ms
23,676 KB
testcase_08 AC 24 ms
23,424 KB
testcase_09 AC 25 ms
23,412 KB
testcase_10 AC 26 ms
24,384 KB
testcase_11 AC 26 ms
23,376 KB
testcase_12 AC 27 ms
23,388 KB
testcase_13 AC 31 ms
24,204 KB
testcase_14 AC 30 ms
23,544 KB
testcase_15 AC 114 ms
23,412 KB
testcase_16 AC 46 ms
24,288 KB
testcase_17 AC 70 ms
23,376 KB
testcase_18 AC 72 ms
23,844 KB
testcase_19 AC 135 ms
23,388 KB
testcase_20 AC 221 ms
23,364 KB
testcase_21 AC 236 ms
23,532 KB
testcase_22 AC 334 ms
24,024 KB
testcase_23 AC 338 ms
23,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::Read;

#[allow(dead_code)]
fn getline() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok().unwrap();
    ret
}

fn get_word() -> String {
    let stdin = std::io::stdin();
    let mut stdin=stdin.lock();
    let mut u8b: [u8; 1] = [0];
    loop {
        let mut buf: Vec<u8> = Vec::with_capacity(16);
        loop {
            let res = stdin.read(&mut u8b);
            if res.unwrap_or(0) == 0 || u8b[0] <= b' ' {
                break;
            } else {
                buf.push(u8b[0]);
            }
        }
        if buf.len() >= 1 {
            let ret = String::from_utf8(buf).unwrap();
            return ret;
        }
    }
}

#[allow(dead_code)]
fn get<T: std::str::FromStr>() -> T { get_word().parse().ok().unwrap() }

fn solve() {
    let n: usize = get();
    let mut ex = vec![];
    for i in 0..n {
        println!("? {}", n - 1);
        let mut v = vec![];
        for j in 0..n {
            if j != i {
                v.push(j);
            }
        }
        for j in 0..n - 1 {
            print!("{}{}", v[j] + 1, if j + 1 == n - 1 { "\n" } else { " " });
        }
        let v: i32 = get();
        if v == 0 {
            ex.push(i + 1);
        }
    }
    println!("! {}", ex.len());
    for j in 0..ex.len() {
        print!("{}{}", ex[j], if j + 1 == ex.len() { "\n" } else { " " });
    }
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}
0