#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m,no[3004][3004],ni[3004][3004],anw;
vector<string> ar;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cin>>n>>m;
for(int i=0;i<n;i++)
{
string a;cin>>a;
ar.push_back(a);
}
for(int i=0;i<n;i++)
{
ll sum=0;
for(int j=m-1;j>=0;j--)
{
if(ar[i][j]=='O')
sum++;
no[i][j]=sum;
}
}
for(int i=0;i<m;i++)
{
ll sum=0;
for(int j=n-1;j>=0;j--)
{
if(ar[j][i]=='I')
sum++;
ni[j][i]=sum;
}
}
for(int i=0;i<n;i++)
for(int j=0;j<m;j++)
if(ar[i][j]=='J')
anw+=ni[i][j]*no[i][j];
cout<<anw;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
3 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
1408 KB |
Output is correct |
6 |
Correct |
4 ms |
1280 KB |
Output is correct |
7 |
Correct |
2 ms |
1152 KB |
Output is correct |
8 |
Correct |
4 ms |
1280 KB |
Output is correct |
9 |
Correct |
3 ms |
1280 KB |
Output is correct |
10 |
Correct |
4 ms |
1152 KB |
Output is correct |
11 |
Correct |
5 ms |
1280 KB |
Output is correct |
12 |
Correct |
3 ms |
1280 KB |
Output is correct |
13 |
Correct |
4 ms |
1152 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 |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
3 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
1408 KB |
Output is correct |
6 |
Correct |
4 ms |
1280 KB |
Output is correct |
7 |
Correct |
2 ms |
1152 KB |
Output is correct |
8 |
Correct |
4 ms |
1280 KB |
Output is correct |
9 |
Correct |
3 ms |
1280 KB |
Output is correct |
10 |
Correct |
4 ms |
1152 KB |
Output is correct |
11 |
Correct |
5 ms |
1280 KB |
Output is correct |
12 |
Correct |
3 ms |
1280 KB |
Output is correct |
13 |
Correct |
4 ms |
1152 KB |
Output is correct |
14 |
Correct |
12 ms |
7552 KB |
Output is correct |
15 |
Correct |
5 ms |
3840 KB |
Output is correct |
16 |
Correct |
7 ms |
4608 KB |
Output is correct |
17 |
Correct |
1 ms |
512 KB |
Output is correct |
18 |
Correct |
13 ms |
8576 KB |
Output is correct |
19 |
Correct |
12 ms |
8448 KB |
Output is correct |
20 |
Correct |
13 ms |
8448 KB |
Output is correct |
21 |
Correct |
12 ms |
8568 KB |
Output is correct |
22 |
Correct |
12 ms |
8448 KB |
Output is correct |
23 |
Correct |
3 ms |
8448 KB |
Output is correct |
24 |
Correct |
14 ms |
8576 KB |
Output is correct |
25 |
Correct |
19 ms |
8316 KB |
Output is correct |
26 |
Correct |
16 ms |
8448 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 |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
3 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
1408 KB |
Output is correct |
6 |
Correct |
4 ms |
1280 KB |
Output is correct |
7 |
Correct |
2 ms |
1152 KB |
Output is correct |
8 |
Correct |
4 ms |
1280 KB |
Output is correct |
9 |
Correct |
3 ms |
1280 KB |
Output is correct |
10 |
Correct |
4 ms |
1152 KB |
Output is correct |
11 |
Correct |
5 ms |
1280 KB |
Output is correct |
12 |
Correct |
3 ms |
1280 KB |
Output is correct |
13 |
Correct |
4 ms |
1152 KB |
Output is correct |
14 |
Correct |
12 ms |
7552 KB |
Output is correct |
15 |
Correct |
5 ms |
3840 KB |
Output is correct |
16 |
Correct |
7 ms |
4608 KB |
Output is correct |
17 |
Correct |
1 ms |
512 KB |
Output is correct |
18 |
Correct |
13 ms |
8576 KB |
Output is correct |
19 |
Correct |
12 ms |
8448 KB |
Output is correct |
20 |
Correct |
13 ms |
8448 KB |
Output is correct |
21 |
Correct |
12 ms |
8568 KB |
Output is correct |
22 |
Correct |
12 ms |
8448 KB |
Output is correct |
23 |
Correct |
3 ms |
8448 KB |
Output is correct |
24 |
Correct |
14 ms |
8576 KB |
Output is correct |
25 |
Correct |
19 ms |
8316 KB |
Output is correct |
26 |
Correct |
16 ms |
8448 KB |
Output is correct |
27 |
Correct |
424 ms |
149920 KB |
Output is correct |
28 |
Correct |
19 ms |
19584 KB |
Output is correct |
29 |
Correct |
21 ms |
13184 KB |
Output is correct |
30 |
Correct |
3 ms |
768 KB |
Output is correct |
31 |
Correct |
302 ms |
124236 KB |
Output is correct |
32 |
Correct |
420 ms |
150308 KB |
Output is correct |
33 |
Correct |
516 ms |
150104 KB |
Output is correct |
34 |
Correct |
347 ms |
143992 KB |
Output is correct |
35 |
Correct |
398 ms |
150544 KB |
Output is correct |
36 |
Correct |
391 ms |
149880 KB |
Output is correct |
37 |
Correct |
454 ms |
150516 KB |
Output is correct |
38 |
Correct |
273 ms |
123476 KB |
Output is correct |
39 |
Correct |
260 ms |
123876 KB |
Output is correct |