#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n,m,orb[3003][3003],ingot[3003][3003],kq = 0;
char a[3003][3003];
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> m;
for(int i = 1; i <= n; i++)
for(int j = 1; j <= m; j++)
cin >> a[i][j];
memset(orb,0,sizeof(orb));
memset(ingot,0,sizeof(ingot));
for(int i = 1; i <= n; i++)
for(int j = 1; j <= m; j++)
{
orb[i][j] = orb[i][j-1] + (a[i][j] == 'O');
}
for(int j = 1; j <= m; j++)
for(int i = 1; i <= n; i++)
ingot[i][j] = ingot[i-1][j] + (a[i][j] == 'I');
for(int i = 1; i <= n; i++)
for(int j = 1; j <= m; j++)
if(a[i][j] == 'J')
kq += (orb[i][m] - orb[i][j]) * (ingot[n][j] - ingot[i][j]);
cout << kq;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
62 ms |
141428 KB |
Output is correct |
2 |
Correct |
56 ms |
141576 KB |
Output is correct |
3 |
Correct |
54 ms |
141424 KB |
Output is correct |
4 |
Correct |
57 ms |
141464 KB |
Output is correct |
5 |
Correct |
60 ms |
143796 KB |
Output is correct |
6 |
Correct |
57 ms |
143620 KB |
Output is correct |
7 |
Correct |
74 ms |
143780 KB |
Output is correct |
8 |
Correct |
55 ms |
143668 KB |
Output is correct |
9 |
Correct |
56 ms |
143832 KB |
Output is correct |
10 |
Correct |
62 ms |
143836 KB |
Output is correct |
11 |
Correct |
67 ms |
143700 KB |
Output is correct |
12 |
Correct |
57 ms |
143700 KB |
Output is correct |
13 |
Correct |
60 ms |
143756 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
62 ms |
141428 KB |
Output is correct |
2 |
Correct |
56 ms |
141576 KB |
Output is correct |
3 |
Correct |
54 ms |
141424 KB |
Output is correct |
4 |
Correct |
57 ms |
141464 KB |
Output is correct |
5 |
Correct |
60 ms |
143796 KB |
Output is correct |
6 |
Correct |
57 ms |
143620 KB |
Output is correct |
7 |
Correct |
74 ms |
143780 KB |
Output is correct |
8 |
Correct |
55 ms |
143668 KB |
Output is correct |
9 |
Correct |
56 ms |
143832 KB |
Output is correct |
10 |
Correct |
62 ms |
143836 KB |
Output is correct |
11 |
Correct |
67 ms |
143700 KB |
Output is correct |
12 |
Correct |
57 ms |
143700 KB |
Output is correct |
13 |
Correct |
60 ms |
143756 KB |
Output is correct |
14 |
Correct |
60 ms |
143608 KB |
Output is correct |
15 |
Correct |
52 ms |
143696 KB |
Output is correct |
16 |
Correct |
54 ms |
143744 KB |
Output is correct |
17 |
Correct |
51 ms |
141472 KB |
Output is correct |
18 |
Correct |
66 ms |
143704 KB |
Output is correct |
19 |
Correct |
53 ms |
143700 KB |
Output is correct |
20 |
Correct |
55 ms |
143860 KB |
Output is correct |
21 |
Correct |
67 ms |
143700 KB |
Output is correct |
22 |
Correct |
66 ms |
143696 KB |
Output is correct |
23 |
Correct |
68 ms |
143832 KB |
Output is correct |
24 |
Correct |
62 ms |
143692 KB |
Output is correct |
25 |
Correct |
54 ms |
143696 KB |
Output is correct |
26 |
Correct |
64 ms |
143700 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
62 ms |
141428 KB |
Output is correct |
2 |
Correct |
56 ms |
141576 KB |
Output is correct |
3 |
Correct |
54 ms |
141424 KB |
Output is correct |
4 |
Correct |
57 ms |
141464 KB |
Output is correct |
5 |
Correct |
60 ms |
143796 KB |
Output is correct |
6 |
Correct |
57 ms |
143620 KB |
Output is correct |
7 |
Correct |
74 ms |
143780 KB |
Output is correct |
8 |
Correct |
55 ms |
143668 KB |
Output is correct |
9 |
Correct |
56 ms |
143832 KB |
Output is correct |
10 |
Correct |
62 ms |
143836 KB |
Output is correct |
11 |
Correct |
67 ms |
143700 KB |
Output is correct |
12 |
Correct |
57 ms |
143700 KB |
Output is correct |
13 |
Correct |
60 ms |
143756 KB |
Output is correct |
14 |
Correct |
60 ms |
143608 KB |
Output is correct |
15 |
Correct |
52 ms |
143696 KB |
Output is correct |
16 |
Correct |
54 ms |
143744 KB |
Output is correct |
17 |
Correct |
51 ms |
141472 KB |
Output is correct |
18 |
Correct |
66 ms |
143704 KB |
Output is correct |
19 |
Correct |
53 ms |
143700 KB |
Output is correct |
20 |
Correct |
55 ms |
143860 KB |
Output is correct |
21 |
Correct |
67 ms |
143700 KB |
Output is correct |
22 |
Correct |
66 ms |
143696 KB |
Output is correct |
23 |
Correct |
68 ms |
143832 KB |
Output is correct |
24 |
Correct |
62 ms |
143692 KB |
Output is correct |
25 |
Correct |
54 ms |
143696 KB |
Output is correct |
26 |
Correct |
64 ms |
143700 KB |
Output is correct |
27 |
Correct |
238 ms |
150440 KB |
Output is correct |
28 |
Correct |
67 ms |
149840 KB |
Output is correct |
29 |
Correct |
71 ms |
143640 KB |
Output is correct |
30 |
Correct |
59 ms |
141648 KB |
Output is correct |
31 |
Correct |
189 ms |
149840 KB |
Output is correct |
32 |
Correct |
228 ms |
150356 KB |
Output is correct |
33 |
Correct |
226 ms |
150356 KB |
Output is correct |
34 |
Correct |
207 ms |
150408 KB |
Output is correct |
35 |
Correct |
230 ms |
150356 KB |
Output is correct |
36 |
Correct |
218 ms |
150404 KB |
Output is correct |
37 |
Correct |
240 ms |
150384 KB |
Output is correct |
38 |
Correct |
165 ms |
149840 KB |
Output is correct |
39 |
Correct |
181 ms |
149840 KB |
Output is correct |