#include <bits/stdc++.h>
using namespace std;
const int mxn = 3030;
string arr[mxn];
#define ll long long
map<pair<ll,ll>,ll> J;
map<ll,ll> O,I;
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n,m;
cin>>n>>m;
for(int i = 0;i<n;i++)cin>>arr[i];
ll ans = 0;
for(int i = n-1;i>=0;i--){
for(int j = m-1;j>=0;j--){
if(arr[i][j] == 'J')ans += O[i]*I[j];
else if(arr[i][j] == 'O')O[i]++;
else I[j]++;
}
}
cout<<ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 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 |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
9 ms |
596 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
5 ms |
468 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
12 ms |
716 KB |
Output is correct |
19 |
Correct |
8 ms |
716 KB |
Output is correct |
20 |
Correct |
8 ms |
724 KB |
Output is correct |
21 |
Correct |
12 ms |
732 KB |
Output is correct |
22 |
Correct |
9 ms |
708 KB |
Output is correct |
23 |
Correct |
8 ms |
720 KB |
Output is correct |
24 |
Correct |
13 ms |
724 KB |
Output is correct |
25 |
Correct |
7 ms |
696 KB |
Output is correct |
26 |
Correct |
7 ms |
716 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 |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
9 ms |
596 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
5 ms |
468 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
12 ms |
716 KB |
Output is correct |
19 |
Correct |
8 ms |
716 KB |
Output is correct |
20 |
Correct |
8 ms |
724 KB |
Output is correct |
21 |
Correct |
12 ms |
732 KB |
Output is correct |
22 |
Correct |
9 ms |
708 KB |
Output is correct |
23 |
Correct |
8 ms |
720 KB |
Output is correct |
24 |
Correct |
13 ms |
724 KB |
Output is correct |
25 |
Correct |
7 ms |
696 KB |
Output is correct |
26 |
Correct |
7 ms |
716 KB |
Output is correct |
27 |
Correct |
632 ms |
9808 KB |
Output is correct |
28 |
Correct |
2 ms |
468 KB |
Output is correct |
29 |
Correct |
24 ms |
1260 KB |
Output is correct |
30 |
Correct |
2 ms |
468 KB |
Output is correct |
31 |
Correct |
434 ms |
7432 KB |
Output is correct |
32 |
Correct |
331 ms |
10408 KB |
Output is correct |
33 |
Correct |
558 ms |
10548 KB |
Output is correct |
34 |
Correct |
508 ms |
8552 KB |
Output is correct |
35 |
Correct |
457 ms |
10292 KB |
Output is correct |
36 |
Correct |
600 ms |
10448 KB |
Output is correct |
37 |
Correct |
639 ms |
10624 KB |
Output is correct |
38 |
Correct |
236 ms |
7216 KB |
Output is correct |
39 |
Correct |
353 ms |
7200 KB |
Output is correct |