CSES - Datatähti 2023 alku - Results
Submission details
Task:Lehmät
Sender:OtsoB
Submission time:2022-11-05 14:12:59 +0200
Language:Python3 (PyPy3)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
Test results
testverdicttimegroup
#10.04 s1, 2details
#20.04 s1, 2details
#30.04 s1, 2details
#40.04 s1, 2details
#50.04 s1, 2details
#60.04 s2details
#70.04 s2details
#80.04 s2details
#90.04 s2details

Code

""" y = input().split()
n = int(y[0])
m = int(y[1])

x = []

for i in range(n):
    x.append(input())
    
x = " ".join(x)
x = x.replace(" ", "")
x = str(x)"""

n = 5
m = 10
x = ".........@@.*******...*.@.@.*@@@*@@@@@*...*******."
x = list(x)
global reunanyli
reunanyli = True

aidat = 0
lehmat = 0
for i in range(0, len(x)):
    if i%m == 0 and i != 0:
 
        aidat = 0
        continue
    if x[i] == ".":
        continue
    elif x[i] == "*":
        aidat += 1

        if x[i-1] != "*" and x[i+1] != "*" and aidat == 2:
            reunanyli = True
        elif x[i-1] == "*":
            reunanyli = True
        elif x[i+1] != "*" and aidat == 1:
            reunanyli = False
        else:
            continue
    elif x[i] == "@":
        if reunanyli == True:
            continue
        if reunanyli == False:
            lehmat += 1
print(lehmat)
            
        

Test details

Test 1

Group: 1, 2

Verdict:

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

correct output
0

user output
7

Test 2

Group: 1, 2

Verdict:

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

correct output
1

user output
7

Test 3

Group: 1, 2

Verdict:

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

correct output
4

user output
7

Test 4

Group: 1, 2

Verdict:

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

correct output
11

user output
7

Test 5

Group: 1, 2

Verdict:

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

correct output
64

user output
7

Test 6

Group: 2

Verdict:

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

correct output
60

user output
7

Test 7

Group: 2

Verdict:

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

correct output
1507

user output
7

Test 8

Group: 2

Verdict:

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

correct output
3348

user output
7

Test 9

Group: 2

Verdict:

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

correct output
7225

user output
7