| Task: | Lehmät |
| Sender: | Tobdu |
| Submission time: | 2022-11-01 15:55:34 +0200 |
| Language: | Python3 (CPython3) |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| #2 | WRONG ANSWER | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.02 s | 1, 2 | details |
| #2 | WRONG ANSWER | 0.02 s | 1, 2 | details |
| #3 | ACCEPTED | 0.02 s | 1, 2 | details |
| #4 | ACCEPTED | 0.02 s | 1, 2 | details |
| #5 | WRONG ANSWER | 0.02 s | 1, 2 | details |
| #6 | WRONG ANSWER | 0.02 s | 2 | details |
| #7 | WRONG ANSWER | 0.02 s | 2 | details |
| #8 | WRONG ANSWER | 0.02 s | 2 | details |
| #9 | WRONG ANSWER | 0.02 s | 2 | details |
Code
# @ cow
# * fence
height, width = input().split(" ")
meadow = []
for i in range(int(height)):
meadow.append(input()[:int(width)])
fence_vertical_start_pos = -1
fence_horizontal_start_pos = -1
fence_width = -1
fence_height = -1
# Get the size and position of the fence
for row in range(int(len(meadow))):
if meadow[row].count("*") > 2:
if fence_vertical_start_pos == -1:
fence_vertical_start_pos = row
for col in range(int(len(meadow[row]))):
if meadow[row][col] == "*":
if fence_horizontal_start_pos != -1:
continue
fence_horizontal_start_pos = col
else:
if fence_horizontal_start_pos == -1:
continue
fence_width = col - fence_horizontal_start_pos
else:
fence_height = row - fence_vertical_start_pos
# Get the area inside the fence
cowmap = []
for y in range(int(len(meadow))):
if y > fence_vertical_start_pos and y < fence_vertical_start_pos + fence_height:
cowmap.append(meadow[y][fence_horizontal_start_pos + 1:fence_horizontal_start_pos + fence_width - 1])
# Count the total amount of cows
cow_total_count = 0
for i in cowmap:
cow_total_count += i.count("@")
print(cow_total_count)
Test details
Test 1
Group: 1, 2
Verdict: ACCEPTED
| input |
|---|
| 3 3 *** *.* *** |
| correct output |
|---|
| 0 |
| user output |
|---|
| 0 |
Test 2
Group: 1, 2
Verdict: WRONG ANSWER
| input |
|---|
| 3 3 *** *@* *** |
| correct output |
|---|
| 1 |
| user output |
|---|
| 0 |
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: WRONG ANSWER
| input |
|---|
| 10 10 ********** *@@@@@@@@* *@@@@@@@@* *@@@@@@@@* ... |
| correct output |
|---|
| 64 |
| user output |
|---|
| 56 |
Test 6
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 100 100 .........................@....... |
| correct output |
|---|
| 60 |
| user output |
|---|
| 64 |
Test 7
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 100 100 ..@@..........@......@....@@..... |
| correct output |
|---|
| 1507 |
| user output |
|---|
| 1544 |
Test 8
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 100 100 .@..@@..@@.@..@..@..@@..@..@..... |
| correct output |
|---|
| 3348 |
| user output |
|---|
| 3464 |
Test 9
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 100 100 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@... |
| correct output |
|---|
| 7225 |
| user output |
|---|
| 7735 |
