Please sign in first.
Submission #5183755
Source Code Expand
fn read<T: ::std::str::FromStr>() -> T {
let mut s = String::new();
::std::io::stdin().read_line(&mut s).ok();
s.trim().parse().ok().unwrap()
}
fn read_vec<T: ::std::str::FromStr>() -> Vec<T> {
let mut s = String::new();
::std::io::stdin().read_line(&mut s).ok();
s.trim().split_whitespace()
.map(|e| e.parse().ok().unwrap()).collect()
}
pub fn main() {
let N: usize = read();
let S: String = read();
let mut w_counter = 0;
let mut start = false;
for c in S.chars() {
if c == '.' {
if !start {
continue;
}
w_counter += 1;
} else {
start = true;
}
}
let mut b_counter = 0;
start = false;
for c in S.chars().rev() {
if c == '#' {
if !start {
continue;
}
b_counter += 1;
} else {
start = true;
}
}
println!("{}", ::std::cmp::min(w_counter, b_counter));
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Stones |
| User | gdmiwasawa |
| Language | Rust (1.15.1) |
| Score | 0 |
| Code Size | 1048 Byte |
| Status | WA |
| Exec Time | 4 ms |
| Memory | 4352 KiB |
Compile Error
warning: function is never used: `read_vec`, #[warn(dead_code)] on by default
--> ./Main.rs:7:1
|
7 | fn read_vec<T: ::std::str::FromStr>() -> Vec<T> {
| _^ starting here...
8 | | let mut s = String::new();
9 | | ::std::io::stdin().read_line(&mut s).ok();
10 | | s.trim().split_whitespace()
11 | | .map(|e| e.parse().ok().unwrap()).collect()
12 | | }
| |_^ ...ending here
warning: unused variable: `N`, #[warn(unused_variables)] on by default
--> ./Main.rs:15:9
|
15 | let N: usize = read();
| ^
warning: variable `N` should have a snake case name such as `n`, #[warn(non_snake_case)] on by default
--> ./Main.rs:15:9
|
15 | let N: usize = read();
| ^
warning: variable `S` should have a snake case name such as `s`, #[warn(non_snake_case)] on by default
--> ./Main.rs:16:9
|
16 | let S: String = read();
| ^
Judge Result
| Set Name | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 300 | ||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | s1.txt, s2.txt, s3.txt |
| All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, s1.txt, s2.txt, s3.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01.txt | WA | 4 ms | 4352 KiB |
| 02.txt | WA | 4 ms | 4352 KiB |
| 03.txt | AC | 4 ms | 4352 KiB |
| 04.txt | WA | 4 ms | 4352 KiB |
| 05.txt | WA | 4 ms | 4352 KiB |
| 06.txt | WA | 4 ms | 4352 KiB |
| 07.txt | AC | 2 ms | 4352 KiB |
| 08.txt | AC | 2 ms | 4352 KiB |
| 09.txt | AC | 2 ms | 4352 KiB |
| 10.txt | AC | 2 ms | 4352 KiB |
| 11.txt | AC | 2 ms | 4352 KiB |
| 12.txt | AC | 2 ms | 4352 KiB |
| 13.txt | AC | 2 ms | 4352 KiB |
| 14.txt | AC | 2 ms | 4352 KiB |
| 15.txt | AC | 2 ms | 4352 KiB |
| 16.txt | AC | 2 ms | 4352 KiB |
| 17.txt | AC | 2 ms | 4352 KiB |
| 18.txt | AC | 2 ms | 4352 KiB |
| 19.txt | AC | 2 ms | 4352 KiB |
| 20.txt | AC | 2 ms | 4352 KiB |
| 21.txt | AC | 2 ms | 4352 KiB |
| 22.txt | AC | 2 ms | 4352 KiB |
| s1.txt | AC | 2 ms | 4352 KiB |
| s2.txt | AC | 2 ms | 4352 KiB |
| s3.txt | AC | 2 ms | 4352 KiB |