Submission #2561365
Source Code Expand
use std::io::*; fn main() { let s = read_v(); let t: u32 = read(); let mut mv = [0; 3]; for c in s.iter() { match c { &'R' => mv[0] += 1, &'L' => mv[0] -= 1, &'U' => mv[1] += 1, &'D' => mv[1] -= 1, &'?' => mv[2] += 1, _ => {} } } if mv[1] < 0 { mv[1] = mv[1]; } if mv[0] < 0 { mv[0] = -mv[0]; } let mut ans = 0; if t == 1 { ans = mv[0] + mv[1] + mv[2]; } else { ans = mv[0] + mv[1] - mv[2]; } println!("{}", ans); } fn read<T: std::str::FromStr>() -> T { let s = stdin(); let b = s.bytes() .map(|b| b.unwrap() as char) .skip_while(|b| b.is_whitespace()) .take_while(|b| !b.is_whitespace()) .collect::<String>(); b.parse::<T>().ok().unwrap() } fn read_v() -> Vec<char> { let s = stdin(); let b = s.bytes() .map(|c| c.unwrap() as char) .take_while(|c| !c.is_whitespace()) .collect(); b } // fn read_v<T: std::str::FromStr>() -> Vec<T> { // let mut s = String::new(); // stdin().read_line(&mut s).expect("failed read_v"); // s.trim() // .split_whitespace() // .map(|c| c.parse::<T>().ok().unwrap()) // .collect::<Vec<T>>() // }
Submission Info
Submission Time | |
---|---|
Task | B - ドローン |
User | celluloce |
Language | Rust (1.15.1) |
Score | 0 |
Code Size | 1387 Byte |
Status | WA |
Exec Time | 8 ms |
Memory | 4352 KB |
Compile Error
warning: value assigned to `ans` is never read, #[warn(unused_assignments)] on by default --> ./Main.rs:26:9 | 26 | let mut ans = 0; | ^^^^^^^
Judge Result
Set Name | Sample | Subtask1 | All | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 100 | 0 / 1 | ||||||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 00_example_04.txt |
Subtask1 | 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 10_rand_01.txt, 10_rand_02.txt, 10_rand_03.txt, 10_rand_04.txt, 20_no_question_01.txt, 20_no_question_02.txt, 20_no_question_03.txt, 20_no_question_04.txt, 30_max_01.txt, 30_max_02.txt, 30_max_03.txt, 30_max_04.txt, 40_corner_01.txt, 40_corner_02.txt, 40_corner_03.txt, 40_corner_04.txt |
All | 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 00_example_04.txt, 10_rand_01.txt, 10_rand_02.txt, 10_rand_03.txt, 10_rand_04.txt, 20_no_question_01.txt, 20_no_question_02.txt, 20_no_question_03.txt, 20_no_question_04.txt, 30_max_01.txt, 30_max_02.txt, 30_max_03.txt, 30_max_04.txt, 40_corner_01.txt, 40_corner_02.txt, 40_corner_03.txt, 40_corner_04.txt, 50_hand_01.txt, 50_hand_02.txt, 50_hand_03.txt, 60_rand_01.txt, 60_rand_02.txt, 60_rand_03.txt, 60_rand_04.txt, 70_no_ques_01.txt, 70_no_ques_02.txt, 70_no_ques_03.txt, 70_no_ques_04.txt, 80_max_01.txt, 80_max_02.txt, 80_max_03.txt, 80_max_04.txt, 90_corner_01.txt, 90_corner_02.txt, 90_corner_03.txt, 90_corner_04.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_example_01.txt | AC | 2 ms | 4352 KB |
00_example_02.txt | AC | 2 ms | 4352 KB |
00_example_03.txt | AC | 2 ms | 4352 KB |
00_example_04.txt | AC | 2 ms | 4352 KB |
10_rand_01.txt | AC | 3 ms | 4352 KB |
10_rand_02.txt | AC | 2 ms | 4352 KB |
10_rand_03.txt | AC | 2 ms | 4352 KB |
10_rand_04.txt | WA | 2 ms | 4352 KB |
20_no_question_01.txt | AC | 3 ms | 4352 KB |
20_no_question_02.txt | AC | 2 ms | 4352 KB |
20_no_question_03.txt | AC | 2 ms | 4352 KB |
20_no_question_04.txt | WA | 2 ms | 4352 KB |
30_max_01.txt | AC | 7 ms | 4352 KB |
30_max_02.txt | WA | 7 ms | 4352 KB |
30_max_03.txt | WA | 7 ms | 4352 KB |
30_max_04.txt | WA | 7 ms | 4352 KB |
40_corner_01.txt | AC | 6 ms | 4352 KB |
40_corner_02.txt | AC | 6 ms | 4352 KB |
40_corner_03.txt | AC | 6 ms | 4352 KB |
40_corner_04.txt | AC | 6 ms | 4352 KB |
50_hand_01.txt | WA | 2 ms | 4352 KB |
50_hand_02.txt | WA | 2 ms | 4352 KB |
50_hand_03.txt | WA | 2 ms | 4352 KB |
60_rand_01.txt | AC | 3 ms | 4352 KB |
60_rand_02.txt | AC | 2 ms | 4352 KB |
60_rand_03.txt | WA | 2 ms | 4352 KB |
60_rand_04.txt | WA | 2 ms | 4352 KB |
70_no_ques_01.txt | AC | 2 ms | 4352 KB |
70_no_ques_02.txt | AC | 2 ms | 4352 KB |
70_no_ques_03.txt | WA | 2 ms | 4352 KB |
70_no_ques_04.txt | WA | 2 ms | 4352 KB |
80_max_01.txt | WA | 7 ms | 4352 KB |
80_max_02.txt | WA | 8 ms | 4352 KB |
80_max_03.txt | WA | 7 ms | 4352 KB |
80_max_04.txt | WA | 7 ms | 4352 KB |
90_corner_01.txt | WA | 6 ms | 4352 KB |
90_corner_02.txt | WA | 6 ms | 4352 KB |
90_corner_03.txt | WA | 6 ms | 4352 KB |
90_corner_04.txt | AC | 6 ms | 4352 KB |