#include <bits/stdc++.h>
using namespace std;const int p=3002;string a[p];int64_t r[p][p],c[p][p];int main(){int n,m;cin>>n>>m;for(int i=1;i<=n;i++){cin>>a[i];a[i]="#"+a[i];for(int j=1;j<=m;j++)r[i][j]=r[i][j-1]+(a[i][j]=='O');}for(int j=1;j<=m;j++)for(int i=1;i<=n;i++)c[j][i]=c[j][i-1]+(a[i][j]=='I');int64_t rs=0;for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)if(a[i][j]=='J')rs+=(r[i][m]-r[i][j])*(c[j][n]-c[j][i]);cout<<rs<<"\n";return 0;}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
400 KB |
Output is correct |
4 |
Correct |
1 ms |
404 KB |
Output is correct |
5 |
Correct |
1 ms |
1364 KB |
Output is correct |
6 |
Correct |
1 ms |
1236 KB |
Output is correct |
7 |
Correct |
1 ms |
1236 KB |
Output is correct |
8 |
Correct |
2 ms |
1364 KB |
Output is correct |
9 |
Correct |
1 ms |
1236 KB |
Output is correct |
10 |
Correct |
1 ms |
1236 KB |
Output is correct |
11 |
Correct |
2 ms |
1364 KB |
Output is correct |
12 |
Correct |
2 ms |
1236 KB |
Output is correct |
13 |
Correct |
2 ms |
1236 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
400 KB |
Output is correct |
4 |
Correct |
1 ms |
404 KB |
Output is correct |
5 |
Correct |
1 ms |
1364 KB |
Output is correct |
6 |
Correct |
1 ms |
1236 KB |
Output is correct |
7 |
Correct |
1 ms |
1236 KB |
Output is correct |
8 |
Correct |
2 ms |
1364 KB |
Output is correct |
9 |
Correct |
1 ms |
1236 KB |
Output is correct |
10 |
Correct |
1 ms |
1236 KB |
Output is correct |
11 |
Correct |
2 ms |
1364 KB |
Output is correct |
12 |
Correct |
2 ms |
1236 KB |
Output is correct |
13 |
Correct |
2 ms |
1236 KB |
Output is correct |
14 |
Correct |
11 ms |
7360 KB |
Output is correct |
15 |
Correct |
2 ms |
2132 KB |
Output is correct |
16 |
Correct |
8 ms |
5652 KB |
Output is correct |
17 |
Correct |
2 ms |
1620 KB |
Output is correct |
18 |
Correct |
12 ms |
8776 KB |
Output is correct |
19 |
Correct |
15 ms |
8532 KB |
Output is correct |
20 |
Correct |
16 ms |
8720 KB |
Output is correct |
21 |
Correct |
18 ms |
8788 KB |
Output is correct |
22 |
Correct |
14 ms |
8532 KB |
Output is correct |
23 |
Correct |
13 ms |
8728 KB |
Output is correct |
24 |
Correct |
14 ms |
8788 KB |
Output is correct |
25 |
Correct |
11 ms |
8532 KB |
Output is correct |
26 |
Correct |
14 ms |
8656 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
400 KB |
Output is correct |
4 |
Correct |
1 ms |
404 KB |
Output is correct |
5 |
Correct |
1 ms |
1364 KB |
Output is correct |
6 |
Correct |
1 ms |
1236 KB |
Output is correct |
7 |
Correct |
1 ms |
1236 KB |
Output is correct |
8 |
Correct |
2 ms |
1364 KB |
Output is correct |
9 |
Correct |
1 ms |
1236 KB |
Output is correct |
10 |
Correct |
1 ms |
1236 KB |
Output is correct |
11 |
Correct |
2 ms |
1364 KB |
Output is correct |
12 |
Correct |
2 ms |
1236 KB |
Output is correct |
13 |
Correct |
2 ms |
1236 KB |
Output is correct |
14 |
Correct |
11 ms |
7360 KB |
Output is correct |
15 |
Correct |
2 ms |
2132 KB |
Output is correct |
16 |
Correct |
8 ms |
5652 KB |
Output is correct |
17 |
Correct |
2 ms |
1620 KB |
Output is correct |
18 |
Correct |
12 ms |
8776 KB |
Output is correct |
19 |
Correct |
15 ms |
8532 KB |
Output is correct |
20 |
Correct |
16 ms |
8720 KB |
Output is correct |
21 |
Correct |
18 ms |
8788 KB |
Output is correct |
22 |
Correct |
14 ms |
8532 KB |
Output is correct |
23 |
Correct |
13 ms |
8728 KB |
Output is correct |
24 |
Correct |
14 ms |
8788 KB |
Output is correct |
25 |
Correct |
11 ms |
8532 KB |
Output is correct |
26 |
Correct |
14 ms |
8656 KB |
Output is correct |
27 |
Correct |
404 ms |
145956 KB |
Output is correct |
28 |
Correct |
7 ms |
10196 KB |
Output is correct |
29 |
Correct |
33 ms |
22444 KB |
Output is correct |
30 |
Correct |
7 ms |
10060 KB |
Output is correct |
31 |
Correct |
291 ms |
124288 KB |
Output is correct |
32 |
Correct |
369 ms |
150060 KB |
Output is correct |
33 |
Correct |
400 ms |
150188 KB |
Output is correct |
34 |
Correct |
349 ms |
134676 KB |
Output is correct |
35 |
Correct |
410 ms |
149948 KB |
Output is correct |
36 |
Correct |
392 ms |
150264 KB |
Output is correct |
37 |
Correct |
440 ms |
150516 KB |
Output is correct |
38 |
Correct |
266 ms |
123556 KB |
Output is correct |
39 |
Correct |
297 ms |
123988 KB |
Output is correct |