#include <bits/stdc++.h>
#define int long long
using namespace std;
struct Art {
int sz, val;
};
const int N = 3e3 + 42, INF = 1e18 + 42, MOD = 1e9 + 7;
char c[N][N];
int lig, col, val[N][2];
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> lig >> col;
for(int i = 0; i < lig; i++)
for(int j = 0; j < col; j++)
cin >> c[i][j];
int ans = 0;
for(int i = lig-1; i > -1; i--)
for(int j = col-1; j > -1; j--)
if(c[i][j] == 'O')
val[i][0]++;
else if(c[i][j] == 'I')
val[j][1]++;
else
ans += val[j][1] * val[i][0];
cout << ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
588 KB |
Output is correct |
6 |
Correct |
1 ms |
588 KB |
Output is correct |
7 |
Correct |
1 ms |
488 KB |
Output is correct |
8 |
Correct |
1 ms |
580 KB |
Output is correct |
9 |
Correct |
1 ms |
588 KB |
Output is correct |
10 |
Correct |
1 ms |
588 KB |
Output is correct |
11 |
Correct |
1 ms |
588 KB |
Output is correct |
12 |
Correct |
1 ms |
588 KB |
Output is correct |
13 |
Correct |
1 ms |
580 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
588 KB |
Output is correct |
6 |
Correct |
1 ms |
588 KB |
Output is correct |
7 |
Correct |
1 ms |
488 KB |
Output is correct |
8 |
Correct |
1 ms |
580 KB |
Output is correct |
9 |
Correct |
1 ms |
588 KB |
Output is correct |
10 |
Correct |
1 ms |
588 KB |
Output is correct |
11 |
Correct |
1 ms |
588 KB |
Output is correct |
12 |
Correct |
1 ms |
588 KB |
Output is correct |
13 |
Correct |
1 ms |
580 KB |
Output is correct |
14 |
Correct |
5 ms |
1896 KB |
Output is correct |
15 |
Correct |
1 ms |
1472 KB |
Output is correct |
16 |
Correct |
3 ms |
1100 KB |
Output is correct |
17 |
Correct |
1 ms |
332 KB |
Output is correct |
18 |
Correct |
6 ms |
1988 KB |
Output is correct |
19 |
Correct |
5 ms |
1996 KB |
Output is correct |
20 |
Correct |
5 ms |
1984 KB |
Output is correct |
21 |
Correct |
6 ms |
1976 KB |
Output is correct |
22 |
Correct |
5 ms |
1988 KB |
Output is correct |
23 |
Correct |
5 ms |
1940 KB |
Output is correct |
24 |
Correct |
8 ms |
2040 KB |
Output is correct |
25 |
Correct |
4 ms |
1996 KB |
Output is correct |
26 |
Correct |
4 ms |
1996 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
588 KB |
Output is correct |
6 |
Correct |
1 ms |
588 KB |
Output is correct |
7 |
Correct |
1 ms |
488 KB |
Output is correct |
8 |
Correct |
1 ms |
580 KB |
Output is correct |
9 |
Correct |
1 ms |
588 KB |
Output is correct |
10 |
Correct |
1 ms |
588 KB |
Output is correct |
11 |
Correct |
1 ms |
588 KB |
Output is correct |
12 |
Correct |
1 ms |
588 KB |
Output is correct |
13 |
Correct |
1 ms |
580 KB |
Output is correct |
14 |
Correct |
5 ms |
1896 KB |
Output is correct |
15 |
Correct |
1 ms |
1472 KB |
Output is correct |
16 |
Correct |
3 ms |
1100 KB |
Output is correct |
17 |
Correct |
1 ms |
332 KB |
Output is correct |
18 |
Correct |
6 ms |
1988 KB |
Output is correct |
19 |
Correct |
5 ms |
1996 KB |
Output is correct |
20 |
Correct |
5 ms |
1984 KB |
Output is correct |
21 |
Correct |
6 ms |
1976 KB |
Output is correct |
22 |
Correct |
5 ms |
1988 KB |
Output is correct |
23 |
Correct |
5 ms |
1940 KB |
Output is correct |
24 |
Correct |
8 ms |
2040 KB |
Output is correct |
25 |
Correct |
4 ms |
1996 KB |
Output is correct |
26 |
Correct |
4 ms |
1996 KB |
Output is correct |
27 |
Correct |
182 ms |
17532 KB |
Output is correct |
28 |
Correct |
3 ms |
7244 KB |
Output is correct |
29 |
Correct |
10 ms |
1728 KB |
Output is correct |
30 |
Correct |
1 ms |
328 KB |
Output is correct |
31 |
Correct |
124 ms |
13792 KB |
Output is correct |
32 |
Correct |
166 ms |
17988 KB |
Output is correct |
33 |
Correct |
131 ms |
17940 KB |
Output is correct |
34 |
Correct |
143 ms |
15940 KB |
Output is correct |
35 |
Correct |
131 ms |
17988 KB |
Output is correct |
36 |
Correct |
132 ms |
17988 KB |
Output is correct |
37 |
Correct |
171 ms |
17988 KB |
Output is correct |
38 |
Correct |
104 ms |
13880 KB |
Output is correct |
39 |
Correct |
95 ms |
13788 KB |
Output is correct |