結果

問題 No.909 たぴの配置
ユーザー phsplsphspls
提出日時 2020-01-27 23:42:31
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 981 bytes
コンパイル時間 2,255 ms
コンパイル使用メモリ 146,644 KB
実行使用メモリ 9,312 KB
最終ジャッジ日時 2023-10-12 18:05:05
合計ジャッジ時間 11,019 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 263 ms
8,960 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::Read;
use std::cmp::min;

fn main() {
    let mut all_data = String::new();
    std::io::stdin().read_to_string(&mut all_data).ok();
    let all_data: Vec<&str> = all_data.trim().split('\n').map(|i| i.trim()).collect();
    let n: usize = all_data.iter().next().unwrap().parse::<usize>().unwrap();
    let x: Vec<usize> = all_data.iter().skip(1).next().unwrap().split_whitespace().map(|i| i.parse::<usize>().unwrap()).collect();
    let y: Vec<usize> = all_data.iter().skip(2).next().unwrap().split_whitespace().map(|i| i.parse::<usize>().unwrap()).collect();
    let minidx2val: (usize, usize) = x.iter().zip(y.iter()).map(|pair| pair.0 + pair.1).enumerate().min_by_key(|pair| pair.1).unwrap();
    println!("{}", minidx2val.1);
    for i in 0..(n+2) {
        if i == 0 {
            println!("{}", 0);
        } else if i == n+1 {
            println!("{}", minidx2val.1);
        } else {
            println!("{}", min(x[i-1], x[minidx2val.0]));
        }
    }
}
0