Submission #791871

# Submission time Handle Problem Language Result Execution time Memory
791871 2023-07-24T12:00:04 Z Boomyday Bitaro the Brave (JOI19_ho_t1) PyPy 3
50 / 100
1000 ms 241240 KB
H, W = map(int, input().split())

grid = []

for i in range(H):
    st = list(input())
    for j in range(W):
        if st[j] == "J":
            st[j] = 0
        elif st[j] == "O":
            st[j] = 1
        elif st[j] == "I":
            st[j] = 2

    grid.append(st)


## grid[h][w]

grido = [[0 for i in range(W+1)] for j in range(H+1)] ## rows
gridi = [[0 for i in range(W+1)] for j in range(H+1)] ## cols



## o

for row in range(H):
    for col in range(W-1, -1, -1):

        num = (grid[row][col] == 1)
        grido[row][col] = grido[row][col+1] + num

## i
for col in range(W):
    for row in range(H-1, -1, -1):
        num = (grid[row][col] == 2)
        gridi[row][col] = gridi[row+1][col] + num

ans = 0

for row in range(H):
    for col in range(W):
        if grid[row][col] == 0:
            ans += grido[row][col+1] * gridi[row+1][col]

print(ans)
# Verdict Execution time Memory Grader output
1 Correct 30 ms 18120 KB Output is correct
2 Correct 29 ms 18124 KB Output is correct
3 Correct 30 ms 18124 KB Output is correct
4 Correct 32 ms 18224 KB Output is correct
5 Correct 65 ms 20524 KB Output is correct
6 Correct 63 ms 22032 KB Output is correct
7 Correct 53 ms 20376 KB Output is correct
8 Correct 59 ms 20472 KB Output is correct
9 Correct 59 ms 21928 KB Output is correct
10 Correct 56 ms 20408 KB Output is correct
11 Correct 52 ms 20032 KB Output is correct
12 Correct 58 ms 21764 KB Output is correct
13 Correct 57 ms 20412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 18120 KB Output is correct
2 Correct 29 ms 18124 KB Output is correct
3 Correct 30 ms 18124 KB Output is correct
4 Correct 32 ms 18224 KB Output is correct
5 Correct 65 ms 20524 KB Output is correct
6 Correct 63 ms 22032 KB Output is correct
7 Correct 53 ms 20376 KB Output is correct
8 Correct 59 ms 20472 KB Output is correct
9 Correct 59 ms 21928 KB Output is correct
10 Correct 56 ms 20408 KB Output is correct
11 Correct 52 ms 20032 KB Output is correct
12 Correct 58 ms 21764 KB Output is correct
13 Correct 57 ms 20412 KB Output is correct
14 Correct 99 ms 26772 KB Output is correct
15 Correct 65 ms 21520 KB Output is correct
16 Correct 83 ms 26124 KB Output is correct
17 Correct 49 ms 20028 KB Output is correct
18 Correct 107 ms 28444 KB Output is correct
19 Correct 102 ms 27984 KB Output is correct
20 Correct 90 ms 27980 KB Output is correct
21 Correct 96 ms 28480 KB Output is correct
22 Correct 96 ms 28036 KB Output is correct
23 Correct 112 ms 28000 KB Output is correct
24 Correct 95 ms 28112 KB Output is correct
25 Correct 91 ms 28152 KB Output is correct
26 Correct 93 ms 27968 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 18120 KB Output is correct
2 Correct 29 ms 18124 KB Output is correct
3 Correct 30 ms 18124 KB Output is correct
4 Correct 32 ms 18224 KB Output is correct
5 Correct 65 ms 20524 KB Output is correct
6 Correct 63 ms 22032 KB Output is correct
7 Correct 53 ms 20376 KB Output is correct
8 Correct 59 ms 20472 KB Output is correct
9 Correct 59 ms 21928 KB Output is correct
10 Correct 56 ms 20408 KB Output is correct
11 Correct 52 ms 20032 KB Output is correct
12 Correct 58 ms 21764 KB Output is correct
13 Correct 57 ms 20412 KB Output is correct
14 Correct 99 ms 26772 KB Output is correct
15 Correct 65 ms 21520 KB Output is correct
16 Correct 83 ms 26124 KB Output is correct
17 Correct 49 ms 20028 KB Output is correct
18 Correct 107 ms 28444 KB Output is correct
19 Correct 102 ms 27984 KB Output is correct
20 Correct 90 ms 27980 KB Output is correct
21 Correct 96 ms 28480 KB Output is correct
22 Correct 96 ms 28036 KB Output is correct
23 Correct 112 ms 28000 KB Output is correct
24 Correct 95 ms 28112 KB Output is correct
25 Correct 91 ms 28152 KB Output is correct
26 Correct 93 ms 27968 KB Output is correct
27 Execution timed out 1095 ms 241240 KB Time limit exceeded
28 Halted 0 ms 0 KB -