#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> ii;
const int N = 3e3 + 5;
int n,m,orb[N],ing[N];
char a[N][N];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
cin >> n >> m;
for (int i = 1 ; i <= n ; i++)
for (int j = 1 ; j <= m ; j++) {
cin >> a[i][j];
if (a[i][j] == 'O')
orb[i]++;
if (a[i][j] == 'I')
ing[j]++;
}
ll ans = 0;
for (int i = 1 ; i <= n ; i++)
for (int j = 1 ; j <= m ; j++) {
if (a[i][j] == 'O')
orb[i]--;
if (a[i][j] == 'I')
ing[j]--;
if (a[i][j] == 'J')
ans += orb[i] * ing[j];
}
cout << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
3 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
640 KB |
Output is correct |
6 |
Correct |
2 ms |
640 KB |
Output is correct |
7 |
Correct |
3 ms |
640 KB |
Output is correct |
8 |
Correct |
3 ms |
640 KB |
Output is correct |
9 |
Correct |
3 ms |
612 KB |
Output is correct |
10 |
Correct |
2 ms |
640 KB |
Output is correct |
11 |
Correct |
3 ms |
640 KB |
Output is correct |
12 |
Correct |
2 ms |
640 KB |
Output is correct |
13 |
Correct |
3 ms |
640 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
3 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
640 KB |
Output is correct |
6 |
Correct |
2 ms |
640 KB |
Output is correct |
7 |
Correct |
3 ms |
640 KB |
Output is correct |
8 |
Correct |
3 ms |
640 KB |
Output is correct |
9 |
Correct |
3 ms |
612 KB |
Output is correct |
10 |
Correct |
2 ms |
640 KB |
Output is correct |
11 |
Correct |
3 ms |
640 KB |
Output is correct |
12 |
Correct |
2 ms |
640 KB |
Output is correct |
13 |
Correct |
3 ms |
640 KB |
Output is correct |
14 |
Correct |
10 ms |
1920 KB |
Output is correct |
15 |
Correct |
4 ms |
1664 KB |
Output is correct |
16 |
Correct |
6 ms |
1152 KB |
Output is correct |
17 |
Correct |
3 ms |
384 KB |
Output is correct |
18 |
Correct |
11 ms |
2048 KB |
Output is correct |
19 |
Correct |
8 ms |
2048 KB |
Output is correct |
20 |
Correct |
7 ms |
2048 KB |
Output is correct |
21 |
Correct |
12 ms |
2048 KB |
Output is correct |
22 |
Correct |
8 ms |
2048 KB |
Output is correct |
23 |
Correct |
7 ms |
1920 KB |
Output is correct |
24 |
Correct |
10 ms |
2048 KB |
Output is correct |
25 |
Correct |
8 ms |
2048 KB |
Output is correct |
26 |
Correct |
7 ms |
2048 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
3 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
640 KB |
Output is correct |
6 |
Correct |
2 ms |
640 KB |
Output is correct |
7 |
Correct |
3 ms |
640 KB |
Output is correct |
8 |
Correct |
3 ms |
640 KB |
Output is correct |
9 |
Correct |
3 ms |
612 KB |
Output is correct |
10 |
Correct |
2 ms |
640 KB |
Output is correct |
11 |
Correct |
3 ms |
640 KB |
Output is correct |
12 |
Correct |
2 ms |
640 KB |
Output is correct |
13 |
Correct |
3 ms |
640 KB |
Output is correct |
14 |
Correct |
10 ms |
1920 KB |
Output is correct |
15 |
Correct |
4 ms |
1664 KB |
Output is correct |
16 |
Correct |
6 ms |
1152 KB |
Output is correct |
17 |
Correct |
3 ms |
384 KB |
Output is correct |
18 |
Correct |
11 ms |
2048 KB |
Output is correct |
19 |
Correct |
8 ms |
2048 KB |
Output is correct |
20 |
Correct |
7 ms |
2048 KB |
Output is correct |
21 |
Correct |
12 ms |
2048 KB |
Output is correct |
22 |
Correct |
8 ms |
2048 KB |
Output is correct |
23 |
Correct |
7 ms |
1920 KB |
Output is correct |
24 |
Correct |
10 ms |
2048 KB |
Output is correct |
25 |
Correct |
8 ms |
2048 KB |
Output is correct |
26 |
Correct |
7 ms |
2048 KB |
Output is correct |
27 |
Correct |
262 ms |
9548 KB |
Output is correct |
28 |
Correct |
8 ms |
7168 KB |
Output is correct |
29 |
Correct |
13 ms |
1280 KB |
Output is correct |
30 |
Correct |
3 ms |
384 KB |
Output is correct |
31 |
Correct |
191 ms |
8056 KB |
Output is correct |
32 |
Correct |
162 ms |
9592 KB |
Output is correct |
33 |
Correct |
138 ms |
9720 KB |
Output is correct |
34 |
Correct |
234 ms |
9212 KB |
Output is correct |
35 |
Correct |
176 ms |
9592 KB |
Output is correct |
36 |
Correct |
135 ms |
9592 KB |
Output is correct |
37 |
Correct |
260 ms |
9592 KB |
Output is correct |
38 |
Correct |
111 ms |
8148 KB |
Output is correct |
39 |
Correct |
91 ms |
8056 KB |
Output is correct |