CSES - Datatähti 2023 alku - Results
Submission details
Task:Lehmät
Sender:eetumaenpaa
Submission time:2022-10-31 00:45:54 +0200
Language:Python3 (CPython3)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
Test results
testverdicttimegroup
#10.02 s1, 2details
#20.02 s1, 2details
#30.02 s1, 2details
#40.02 s1, 2details
#50.02 s1, 2details
#60.02 s2details
#70.02 s2details
#80.02 s2details
#90.02 s2details

Code

[height, width] = [int(x) for x in input().split(" ")]
rows = [input() for x in range(height)]

min_y = min([y for y in range(height) if rows[y].count("*") > 0])
max_y = max([y for y in range(height) if rows[y].count("*") > 0])

min_x = min([x for x in range(width) if rows[min_y][x] == "*"])
max_x = max([x for x in range(width) if rows[min_y][x] == "*"])

print(min_y, max_y, min_x, max_x)

cow_count = 0
for x in range(min_x, max_x + 1):
    for y in range(min_y, max_y + 1):
        if rows[y][x] == "@":
            cow_count += 1

print(cow_count)

Test details

Test 1

Group: 1, 2

Verdict:

input
3 3
***
*.*
***

correct output
0

user output
0 2 0 2
0

Test 2

Group: 1, 2

Verdict:

input
3 3
***
*@*
***

correct output
1

user output
0 2 0 2
1

Test 3

Group: 1, 2

Verdict:

input
5 10
...@......
..******..
@.*@@@@*.@
..******..
...

correct output
4

user output
1 3 2 7
4

Test 4

Group: 1, 2

Verdict:

input
10 10
@@...@.@@@
..@@.@@..@
@.*******@
..*@....*.
...

correct output
11

user output
2 8 2 8
11

Test 5

Group: 1, 2

Verdict:

input
10 10
**********
*@@@@@@@@*
*@@@@@@@@*
*@@@@@@@@*
...

correct output
64

user output
0 9 0 9
64

Test 6

Group: 2

Verdict:

input
100 100
.........................@.......

correct output
60

user output
6 93 10 91
60

Test 7

Group: 2

Verdict:

input
100 100
..@@..........@......@....@@.....

correct output
1507

user output
9 94 5 94
1507

Test 8

Group: 2

Verdict:

input
100 100
.@..@@..@@.@..@..@..@@..@..@.....

correct output
3348

user output
10 91 9 94
3348

Test 9

Group: 2

Verdict:

input
100 100
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...

correct output
7225

user output
8 94 5 91
7225