답안 #791873

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
791873 2023-07-24T12:00:46 Z Boomyday Bitaro the Brave (JOI19_ho_t1) PyPy 3
50 / 100
1000 ms 231464 KB
from sys import stdin

H, W = map(int, input().split())

grid = []

for i in range(H):
    st = list(stdin.readline().strip())
    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)
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 18152 KB Output is correct
2 Correct 31 ms 18144 KB Output is correct
3 Correct 30 ms 18172 KB Output is correct
4 Correct 30 ms 18228 KB Output is correct
5 Correct 51 ms 20276 KB Output is correct
6 Correct 52 ms 21188 KB Output is correct
7 Correct 50 ms 20028 KB Output is correct
8 Correct 51 ms 20236 KB Output is correct
9 Correct 52 ms 21196 KB Output is correct
10 Correct 50 ms 20052 KB Output is correct
11 Correct 52 ms 20528 KB Output is correct
12 Correct 59 ms 21228 KB Output is correct
13 Correct 51 ms 20048 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 18152 KB Output is correct
2 Correct 31 ms 18144 KB Output is correct
3 Correct 30 ms 18172 KB Output is correct
4 Correct 30 ms 18228 KB Output is correct
5 Correct 51 ms 20276 KB Output is correct
6 Correct 52 ms 21188 KB Output is correct
7 Correct 50 ms 20028 KB Output is correct
8 Correct 51 ms 20236 KB Output is correct
9 Correct 52 ms 21196 KB Output is correct
10 Correct 50 ms 20052 KB Output is correct
11 Correct 52 ms 20528 KB Output is correct
12 Correct 59 ms 21228 KB Output is correct
13 Correct 51 ms 20048 KB Output is correct
14 Correct 81 ms 26520 KB Output is correct
15 Correct 73 ms 21132 KB Output is correct
16 Correct 70 ms 24928 KB Output is correct
17 Correct 54 ms 20104 KB Output is correct
18 Correct 85 ms 27256 KB Output is correct
19 Correct 98 ms 27308 KB Output is correct
20 Correct 88 ms 27032 KB Output is correct
21 Correct 84 ms 27012 KB Output is correct
22 Correct 77 ms 27192 KB Output is correct
23 Correct 84 ms 27056 KB Output is correct
24 Correct 91 ms 27576 KB Output is correct
25 Correct 97 ms 27084 KB Output is correct
26 Correct 84 ms 27068 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 18152 KB Output is correct
2 Correct 31 ms 18144 KB Output is correct
3 Correct 30 ms 18172 KB Output is correct
4 Correct 30 ms 18228 KB Output is correct
5 Correct 51 ms 20276 KB Output is correct
6 Correct 52 ms 21188 KB Output is correct
7 Correct 50 ms 20028 KB Output is correct
8 Correct 51 ms 20236 KB Output is correct
9 Correct 52 ms 21196 KB Output is correct
10 Correct 50 ms 20052 KB Output is correct
11 Correct 52 ms 20528 KB Output is correct
12 Correct 59 ms 21228 KB Output is correct
13 Correct 51 ms 20048 KB Output is correct
14 Correct 81 ms 26520 KB Output is correct
15 Correct 73 ms 21132 KB Output is correct
16 Correct 70 ms 24928 KB Output is correct
17 Correct 54 ms 20104 KB Output is correct
18 Correct 85 ms 27256 KB Output is correct
19 Correct 98 ms 27308 KB Output is correct
20 Correct 88 ms 27032 KB Output is correct
21 Correct 84 ms 27012 KB Output is correct
22 Correct 77 ms 27192 KB Output is correct
23 Correct 84 ms 27056 KB Output is correct
24 Correct 91 ms 27576 KB Output is correct
25 Correct 97 ms 27084 KB Output is correct
26 Correct 84 ms 27068 KB Output is correct
27 Execution timed out 1078 ms 231464 KB Time limit exceeded
28 Halted 0 ms 0 KB -