#include "bits/stdc++.h"
using namespace std;
#define ar array
#define int long long
signed main(){
ios::sync_with_stdio(0); cin.tie(0);
int n, m; cin>>n>>m;
vector<string> a(n);
for(int i=0;i<n;i++) cin>>a[i];
vector<int> row(n), col(m);
int res = 0;
for(int i=n-1;~i;i--){
for(int j=m-1;~j;j--){
if(a[i][j] == 'J'){
res += row[i] * col[j];
}
if(a[i][j] == 'O') row[i]++;
if(a[i][j] == 'I') col[j]++;
}
}
cout<<res<<"\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
312 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
0 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
316 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
320 KB |
Output is correct |
12 |
Correct |
0 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
312 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
0 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
316 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
320 KB |
Output is correct |
12 |
Correct |
0 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
2 ms |
716 KB |
Output is correct |
15 |
Correct |
1 ms |
332 KB |
Output is correct |
16 |
Correct |
1 ms |
568 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
3 ms |
716 KB |
Output is correct |
19 |
Correct |
1 ms |
700 KB |
Output is correct |
20 |
Correct |
1 ms |
716 KB |
Output is correct |
21 |
Correct |
3 ms |
844 KB |
Output is correct |
22 |
Correct |
2 ms |
716 KB |
Output is correct |
23 |
Correct |
2 ms |
700 KB |
Output is correct |
24 |
Correct |
3 ms |
844 KB |
Output is correct |
25 |
Correct |
2 ms |
704 KB |
Output is correct |
26 |
Correct |
1 ms |
716 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
312 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
0 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
316 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
320 KB |
Output is correct |
12 |
Correct |
0 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
2 ms |
716 KB |
Output is correct |
15 |
Correct |
1 ms |
332 KB |
Output is correct |
16 |
Correct |
1 ms |
568 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
3 ms |
716 KB |
Output is correct |
19 |
Correct |
1 ms |
700 KB |
Output is correct |
20 |
Correct |
1 ms |
716 KB |
Output is correct |
21 |
Correct |
3 ms |
844 KB |
Output is correct |
22 |
Correct |
2 ms |
716 KB |
Output is correct |
23 |
Correct |
2 ms |
700 KB |
Output is correct |
24 |
Correct |
3 ms |
844 KB |
Output is correct |
25 |
Correct |
2 ms |
704 KB |
Output is correct |
26 |
Correct |
1 ms |
716 KB |
Output is correct |
27 |
Correct |
77 ms |
17860 KB |
Output is correct |
28 |
Correct |
1 ms |
332 KB |
Output is correct |
29 |
Correct |
3 ms |
1600 KB |
Output is correct |
30 |
Correct |
1 ms |
348 KB |
Output is correct |
31 |
Correct |
55 ms |
13264 KB |
Output is correct |
32 |
Correct |
37 ms |
18720 KB |
Output is correct |
33 |
Correct |
32 ms |
18844 KB |
Output is correct |
34 |
Correct |
64 ms |
15152 KB |
Output is correct |
35 |
Correct |
33 ms |
18808 KB |
Output is correct |
36 |
Correct |
32 ms |
19016 KB |
Output is correct |
37 |
Correct |
76 ms |
18840 KB |
Output is correct |
38 |
Correct |
26 ms |
12980 KB |
Output is correct |
39 |
Correct |
23 ms |
13148 KB |
Output is correct |