Task: | Lehmät |
Sender: | fait |
Submission time: | 2022-10-31 19:40:08 +0200 |
Language: | Rust |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | RUNTIME ERROR | 0 |
#2 | RUNTIME ERROR | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | RUNTIME ERROR | 0.00 s | 1, 2 | details |
#2 | RUNTIME ERROR | 0.00 s | 1, 2 | details |
#3 | ACCEPTED | 0.00 s | 1, 2 | details |
#4 | ACCEPTED | 0.00 s | 1, 2 | details |
#5 | RUNTIME ERROR | 0.00 s | 1, 2 | details |
#6 | ACCEPTED | 0.00 s | 2 | details |
#7 | ACCEPTED | 0.00 s | 2 | details |
#8 | ACCEPTED | 0.00 s | 2 | details |
#9 | ACCEPTED | 0.00 s | 2 | details |
Code
fn main() { let mut buffer = String::new(); std::io::stdin().read_line(&mut buffer).unwrap(); let nm: Vec<&str> = buffer.trim().split(' ').collect(); let n = nm[0].parse::<i32>().unwrap(); let _m = nm[1].parse::<i32>().unwrap(); let mut cows: Vec<Vec<char>> = Vec::new(); let mut count: usize = 0; for _ in 0..n { let mut buffer_t = String::new(); std::io::stdin().read_line(&mut buffer_t).unwrap(); count += buffer_t.matches('@').count(); cows.push(buffer_t.trim().chars().collect()); } let mut inside: bool = false; for j in 0..cows.len() { for k in 0..cows[j].len() { if cows[j][k] == '*' && cows[j][std::cmp::min(k + 1, cows[j].len() - 1)] != '*' && cows[j][std::cmp::max(k - 1, 0)] != '*' { inside = !inside; } if cows[j][k] == '@' && !inside { count -= 1_usize; } } } println!("{}", count); }
Test details
Test 1
Group: 1, 2
Verdict: RUNTIME ERROR
input |
---|
3 3 *** *.* *** |
correct output |
---|
0 |
user output |
---|
(empty) |
Error:
thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 184467440737...
Test 2
Group: 1, 2
Verdict: RUNTIME ERROR
input |
---|
3 3 *** *@* *** |
correct output |
---|
1 |
user output |
---|
(empty) |
Error:
thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 184467440737...
Test 3
Group: 1, 2
Verdict: ACCEPTED
input |
---|
5 10 ...@...... ..******.. @.*@@@@*.@ ..******.. ... |
correct output |
---|
4 |
user output |
---|
4 |
Test 4
Group: 1, 2
Verdict: ACCEPTED
input |
---|
10 10 @@...@.@@@ ..@@.@@..@ @.*******@ ..*@....*. ... |
correct output |
---|
11 |
user output |
---|
11 |
Test 5
Group: 1, 2
Verdict: RUNTIME ERROR
input |
---|
10 10 ********** *@@@@@@@@* *@@@@@@@@* *@@@@@@@@* ... |
correct output |
---|
64 |
user output |
---|
(empty) |
Error:
thread 'main' panicked at 'index out of bounds: the len is 10 but the index is 18446744073...
Test 6
Group: 2
Verdict: ACCEPTED
input |
---|
100 100 .........................@....... |
correct output |
---|
60 |
user output |
---|
60 |
Test 7
Group: 2
Verdict: ACCEPTED
input |
---|
100 100 ..@@..........@......@....@@..... |
correct output |
---|
1507 |
user output |
---|
1507 |
Test 8
Group: 2
Verdict: ACCEPTED
input |
---|
100 100 .@..@@..@@.@..@..@..@@..@..@..... |
correct output |
---|
3348 |
user output |
---|
3348 |
Test 9
Group: 2
Verdict: ACCEPTED
input |
---|
100 100 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@... |
correct output |
---|
7225 |
user output |
---|
7225 |