답안 #548242

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
548242 2022-04-12T19:00:31 Z beaconmc Bitaro the Brave (JOI19_ho_t1) PyPy 3
50 / 100
661 ms 274432 KB
h,w = map(int, input().split())

grid = [list(input()) for i in range(h)]

prefx = [[0 for i in range(w)]for i in range(h)]
prefy = [[0 for i in range(w)]for i in range(h)]


for i in range(h):
    for j in range(w):
        if (j==0 and grid[i][j] == "O"):
            prefx[i][j] = 1
        else:
            prefx[i][j] = prefx[i][j-1] + bool(grid[i][j] == "O")

for i in range(h):
    for j in range(w):
        if (i==0 and grid[i][j] == "I"):
            prefy[i][j] = 1
        else:
            prefy[i][j] = prefy[i-1][j] + bool(grid[i][j] == "I")
ans = 0
for i in range(h):
    for j in range(w):
        if grid[i][j] == "J":
            ans += (prefx[i][w-1] - prefx[i][j])*(prefy[h-1][j] - prefy[i][j])
print(ans)
            
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 18156 KB Output is correct
2 Correct 34 ms 18208 KB Output is correct
3 Correct 36 ms 18220 KB Output is correct
4 Correct 39 ms 18220 KB Output is correct
5 Correct 60 ms 20644 KB Output is correct
6 Correct 62 ms 21128 KB Output is correct
7 Correct 59 ms 20696 KB Output is correct
8 Correct 58 ms 20232 KB Output is correct
9 Correct 58 ms 20644 KB Output is correct
10 Correct 67 ms 20684 KB Output is correct
11 Correct 59 ms 20252 KB Output is correct
12 Correct 58 ms 21140 KB Output is correct
13 Correct 63 ms 20704 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 18156 KB Output is correct
2 Correct 34 ms 18208 KB Output is correct
3 Correct 36 ms 18220 KB Output is correct
4 Correct 39 ms 18220 KB Output is correct
5 Correct 60 ms 20644 KB Output is correct
6 Correct 62 ms 21128 KB Output is correct
7 Correct 59 ms 20696 KB Output is correct
8 Correct 58 ms 20232 KB Output is correct
9 Correct 58 ms 20644 KB Output is correct
10 Correct 67 ms 20684 KB Output is correct
11 Correct 59 ms 20252 KB Output is correct
12 Correct 58 ms 21140 KB Output is correct
13 Correct 63 ms 20704 KB Output is correct
14 Correct 114 ms 31572 KB Output is correct
15 Correct 73 ms 20856 KB Output is correct
16 Correct 88 ms 27168 KB Output is correct
17 Correct 58 ms 19232 KB Output is correct
18 Correct 131 ms 34852 KB Output is correct
19 Correct 122 ms 33800 KB Output is correct
20 Correct 130 ms 34708 KB Output is correct
21 Correct 130 ms 34416 KB Output is correct
22 Correct 117 ms 34424 KB Output is correct
23 Correct 120 ms 34664 KB Output is correct
24 Correct 121 ms 34500 KB Output is correct
25 Correct 118 ms 34136 KB Output is correct
26 Correct 123 ms 34728 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 18156 KB Output is correct
2 Correct 34 ms 18208 KB Output is correct
3 Correct 36 ms 18220 KB Output is correct
4 Correct 39 ms 18220 KB Output is correct
5 Correct 60 ms 20644 KB Output is correct
6 Correct 62 ms 21128 KB Output is correct
7 Correct 59 ms 20696 KB Output is correct
8 Correct 58 ms 20232 KB Output is correct
9 Correct 58 ms 20644 KB Output is correct
10 Correct 67 ms 20684 KB Output is correct
11 Correct 59 ms 20252 KB Output is correct
12 Correct 58 ms 21140 KB Output is correct
13 Correct 63 ms 20704 KB Output is correct
14 Correct 114 ms 31572 KB Output is correct
15 Correct 73 ms 20856 KB Output is correct
16 Correct 88 ms 27168 KB Output is correct
17 Correct 58 ms 19232 KB Output is correct
18 Correct 131 ms 34852 KB Output is correct
19 Correct 122 ms 33800 KB Output is correct
20 Correct 130 ms 34708 KB Output is correct
21 Correct 130 ms 34416 KB Output is correct
22 Correct 117 ms 34424 KB Output is correct
23 Correct 120 ms 34664 KB Output is correct
24 Correct 121 ms 34500 KB Output is correct
25 Correct 118 ms 34136 KB Output is correct
26 Correct 123 ms 34728 KB Output is correct
27 Runtime error 661 ms 274432 KB Execution killed with signal 9
28 Halted 0 ms 0 KB -