| Task: | Lehmät |
| Sender: | Mixu_78 |
| Submission time: | 2022-11-05 22:19:42 +0200 |
| Language: | Rust |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| #2 | WRONG ANSWER | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | WRONG ANSWER | 0.00 s | 1, 2 | details |
| #2 | WRONG ANSWER | 0.00 s | 1, 2 | details |
| #3 | WRONG ANSWER | 0.00 s | 1, 2 | details |
| #4 | WRONG ANSWER | 0.00 s | 1, 2 | details |
| #5 | WRONG ANSWER | 0.00 s | 1, 2 | details |
| #6 | WRONG ANSWER | 0.00 s | 2 | details |
| #7 | WRONG ANSWER | 0.00 s | 2 | details |
| #8 | WRONG ANSWER | 0.00 s | 2 | details |
| #9 | WRONG ANSWER | 0.00 s | 2 | details |
Compiler report
warning: unused variable: `m` --> input/code.rs:11:9 | 11 | let m: usize = split.next().unwrap().parse().unwrap(); | ^ help: if this is intentional, prefix it with an underscore: `_m` | = note: `#[warn(unused_variables)]` on by default warning: unused variable: `map` --> input/code.rs:13:13 | 13 | let mut map: Vec<String> = Vec::with_capacity(n); | ^^^ help: if this is intentional, prefix it with an underscore: `_map` warning: variable does not need to be mutable --> input/code.rs:13:9 | 13 | let mut map: Vec<String> = Vec::with_capacity(n); | ----^^^ | | | help: remove this `mut` | = note: `#[warn(unused_mut)]` on by default warning: 3 warnings emitted
Code
use std::io::{self, BufReader, BufRead};
fn main() {
let stdin = io::stdin();
let buf = BufReader::new(stdin);
let mut lines = buf.lines();
let dim = lines.next().unwrap().unwrap();
let mut split = dim.split(" ");
let n: usize = split.next().unwrap().parse().unwrap();
let m: usize = split.next().unwrap().parse().unwrap();
let mut map: Vec<String> = Vec::with_capacity(n);
let mut start: (usize, usize) = (0, 0);
let mut end: (usize, usize) = (0, 0);
let mut cows = 0;
for y in 0..n {
let line = lines.next().unwrap().unwrap();
if start == (0, 0) {
if let Some(x) = line.find('*') {
start = (y, x);
end = (n, line.rfind('*').unwrap())
}
} else {
if y > start.0 {
if line.find('*').is_none() {
end = (y - 1, end.1);
}
cows += line
.chars()
.enumerate()
.fold(0, |acc, (i, c)| if i > start.1 && i < end.1 && c == '@' { acc + 1 } else { acc + 0 });
}
}
}
println!("{start:?}, {end:?}, {cows}")
}
Test details
Test 1
Group: 1, 2
Verdict: WRONG ANSWER
| input |
|---|
| 3 3 *** *.* *** |
| correct output |
|---|
| 0 |
| user output |
|---|
| (1, 0), (3, 2), 0 |
Test 2
Group: 1, 2
Verdict: WRONG ANSWER
| input |
|---|
| 3 3 *** *@* *** |
| correct output |
|---|
| 1 |
| user output |
|---|
| (1, 0), (3, 2), 0 |
Test 3
Group: 1, 2
Verdict: WRONG ANSWER
| input |
|---|
| 5 10 ...@...... ..******.. @.*@@@@*.@ ..******.. ... |
| correct output |
|---|
| 4 |
| user output |
|---|
| (1, 2), (3, 7), 5 |
Test 4
Group: 1, 2
Verdict: WRONG ANSWER
| input |
|---|
| 10 10 @@...@.@@@ ..@@.@@..@ @.*******@ ..*@....*. ... |
| correct output |
|---|
| 11 |
| user output |
|---|
| (2, 2), (8, 8), 13 |
Test 5
Group: 1, 2
Verdict: WRONG ANSWER
| input |
|---|
| 10 10 ********** *@@@@@@@@* *@@@@@@@@* *@@@@@@@@* ... |
| correct output |
|---|
| 64 |
| user output |
|---|
| (1, 0), (10, 9), 56 |
Test 6
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 100 100 .........................@....... |
| correct output |
|---|
| 60 |
| user output |
|---|
| (6, 10), (98, 91), 68 |
Test 7
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 100 100 ..@@..........@......@....@@..... |
| correct output |
|---|
| 1507 |
| user output |
|---|
| (9, 5), (98, 94), 1604 |
Test 8
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 100 100 .@..@@..@@.@..@..@..@@..@..@..... |
| correct output |
|---|
| 3348 |
| user output |
|---|
| (10, 9), (98, 94), 3679 |
Test 9
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 100 100 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@... |
| correct output |
|---|
| 7225 |
| user output |
|---|
| (8, 5), (98, 91), 7650 |
