Submission #1023566

# Submission time Handle Problem Language Result Execution time Memory
1023566 2024-07-15T02:37:13 Z vjudge1 Bitaro the Brave (JOI19_ho_t1) Python 3
50 / 100
1000 ms 206988 KB
n, m = map(int, input().split())
a = [[0 for _ in range(m + 1)] for _ in range(n + 1)]
d1 = [[0 for _ in range(m + 1)] for _ in range(n + 1)]
d2 = [[0 for _ in range(m + 1)] for _ in range(n + 1)]

for i in range(1, n + 1) :
    s = input()
    for j in range(1, m + 1) :
        a[i][j] = 0 if s[j - 1] == 'J' else 1 if s[j - 1] == 'O' else 2
        
ans = 0
for i in range(n, 0, -1) :
    for j in range(m, 0, -1) :
        d1[i][j] = (a[i][j] == 1) + (0 if j == m else d1[i][j + 1])
        d2[i][j] = (a[i][j] == 2) + (0 if i == n else d2[i + 1][j])
        if a[i][j] == 0 :
            ans += d1[i][j] * d2[i][j]
print(ans)
# Verdict Execution time Memory Grader output
1 Correct 10 ms 2908 KB Output is correct
2 Correct 10 ms 3032 KB Output is correct
3 Correct 10 ms 2876 KB Output is correct
4 Correct 10 ms 2852 KB Output is correct
5 Correct 18 ms 3580 KB Output is correct
6 Correct 16 ms 3108 KB Output is correct
7 Correct 17 ms 3176 KB Output is correct
8 Correct 18 ms 3164 KB Output is correct
9 Correct 18 ms 3276 KB Output is correct
10 Correct 17 ms 3164 KB Output is correct
11 Correct 20 ms 3060 KB Output is correct
12 Correct 16 ms 3164 KB Output is correct
13 Correct 18 ms 3284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 2908 KB Output is correct
2 Correct 10 ms 3032 KB Output is correct
3 Correct 10 ms 2876 KB Output is correct
4 Correct 10 ms 2852 KB Output is correct
5 Correct 18 ms 3580 KB Output is correct
6 Correct 16 ms 3108 KB Output is correct
7 Correct 17 ms 3176 KB Output is correct
8 Correct 18 ms 3164 KB Output is correct
9 Correct 18 ms 3276 KB Output is correct
10 Correct 17 ms 3164 KB Output is correct
11 Correct 20 ms 3060 KB Output is correct
12 Correct 16 ms 3164 KB Output is correct
13 Correct 18 ms 3284 KB Output is correct
14 Correct 176 ms 7764 KB Output is correct
15 Correct 19 ms 3164 KB Output is correct
16 Correct 117 ms 6564 KB Output is correct
17 Correct 12 ms 2908 KB Output is correct
18 Correct 233 ms 9280 KB Output is correct
19 Correct 191 ms 11348 KB Output is correct
20 Correct 203 ms 9044 KB Output is correct
21 Correct 215 ms 9308 KB Output is correct
22 Correct 196 ms 10568 KB Output is correct
23 Correct 200 ms 9052 KB Output is correct
24 Correct 201 ms 9268 KB Output is correct
25 Correct 200 ms 11860 KB Output is correct
26 Correct 200 ms 9148 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 2908 KB Output is correct
2 Correct 10 ms 3032 KB Output is correct
3 Correct 10 ms 2876 KB Output is correct
4 Correct 10 ms 2852 KB Output is correct
5 Correct 18 ms 3580 KB Output is correct
6 Correct 16 ms 3108 KB Output is correct
7 Correct 17 ms 3176 KB Output is correct
8 Correct 18 ms 3164 KB Output is correct
9 Correct 18 ms 3276 KB Output is correct
10 Correct 17 ms 3164 KB Output is correct
11 Correct 20 ms 3060 KB Output is correct
12 Correct 16 ms 3164 KB Output is correct
13 Correct 18 ms 3284 KB Output is correct
14 Correct 176 ms 7764 KB Output is correct
15 Correct 19 ms 3164 KB Output is correct
16 Correct 117 ms 6564 KB Output is correct
17 Correct 12 ms 2908 KB Output is correct
18 Correct 233 ms 9280 KB Output is correct
19 Correct 191 ms 11348 KB Output is correct
20 Correct 203 ms 9044 KB Output is correct
21 Correct 215 ms 9308 KB Output is correct
22 Correct 196 ms 10568 KB Output is correct
23 Correct 200 ms 9052 KB Output is correct
24 Correct 201 ms 9268 KB Output is correct
25 Correct 200 ms 11860 KB Output is correct
26 Correct 200 ms 9148 KB Output is correct
27 Execution timed out 1045 ms 206988 KB Time limit exceeded
28 Halted 0 ms 0 KB -