結果
問題 | No.2184 A○B問題 |
ユーザー |
![]() |
提出日時 | 2023-03-22 16:41:34 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 1,684 bytes |
コンパイル時間 | 13,239 ms |
コンパイル使用メモリ | 377,524 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-18 14:58:36 |
合計ジャッジ時間 | 12,387 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 |
コンパイルメッセージ
warning: unused import: `std::time::Instant` --> src/main.rs:4:5 | 4 | use std::time::Instant; | ^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: unused variable: `count` --> src/main.rs:10:13 | 10 | let mut count = 0; | ^^^^^ help: if this is intentional, prefix it with an underscore: `_count` | = note: `#[warn(unused_variables)]` on by default warning: variable does not need to be mutable --> src/main.rs:10:9 | 10 | let mut count = 0; | ----^^^^^ | | | help: remove this `mut` | = note: `#[warn(unused_mut)]` on by default
ソースコード
use std::io::*;//use std::num;use std::str::FromStr;use std::time::Instant;fn main() {//let now = Instant::now();let mut a: Vec<usize> = vec![0; 5];let mut b: Vec<usize> = vec![0; 5];let mut count = 0;for _i in 0..a.len(){a[_i] = read();}for _i in 0..b.len(){b[_i] = read();}for _i in 0..b.len(){print!("{}",a[b[_i]-1]);if _i == a.len()-1{break;}else{print!(" ");}}//println!("[DEBUG_PRINT] {} ms", now.elapsed().as_millis());}pub fn min(x: usize, y: usize) -> usize {let z: usize;if x <= y {z = x;} else {z = y;}return z;}pub fn read<T: FromStr>() -> T {let stdin = stdin();let stdin = stdin.lock();let token: String = stdin.bytes().map(|c| c.expect("failed to read char") as char).skip_while(|c| c.is_whitespace()).take_while(|c| !c.is_whitespace()).collect();token.parse().ok().expect("failed to parse token")}pub fn read_array() -> Vec<char> {let array: String = read();let chars: Vec<char> = array.trim().chars().collect::<Vec<char>>();chars}pub fn get_data() -> Vec<u64> {let mut s: String = String::new();std::io::stdin().read_line(&mut s).ok();let vec: Vec<u64> = s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();vec}pub fn get_chars() -> Vec<char> {let mut s: String = String::new();std::io::stdin().read_line(&mut s).ok();let vec: Vec<char> = s.trim().chars().collect::<Vec<char>>();vec}