Submission #828621

#TimeUsernameProblemLanguageResultExecution timeMemory
828621ImeonBitaro the Brave (JOI19_ho_t1)Pypy 3
0 / 100
29 ms18228 KiB
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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...