Submission #828621

# Submission time Handle Problem Language Result Execution time Memory
828621 2023-08-17T12:50:07 Z Imeon Bitaro the Brave (JOI19_ho_t1) PyPy 3
0 / 100
29 ms 18228 KB
n, m = map(int,input().split())
v = []
for i in range(n):
    s = input()
    v += [s]
cnt_o = [[0 for i in range(m + 1)]for i in range(n + 1)]
cnt_i = [[0 for i in range(n + 1)]for i in range(m + 1)]

for i in range(n):
    x = 0
    for j in range(m):
        if v[i][j] == 'O':
            x += 1
        cnt_o[i][j] = x
for i in range(m):
    for j in range(n):
        ok = 0
        if v[j][i] == 'I':ok = 1
        cnt_i[i][j] = cnt_i[i][j - 1] + ok
ans  =0
for i in range(n):
    for j in range(m):
        if v[i][j] == 'J':
            print(i,j)
            x = cnt_o[i][m - 1] - cnt_o[i][j]
            y = cnt_i[j][n - 1] - cnt_i[j][i]
        #    print(x,y)
            ans += x * y
print(ans)
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 18228 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 18228 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 18228 KB Output isn't correct
2 Halted 0 ms 0 KB -