#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll ans,x,y,n,m,i,j,k,l;
char s[3001][3001];
int main(){
cin >> n >> m;
for(i=1;i<=n;i++){
for(j=1;j<=m;j++){
cin >> s[i][j];
}
}
for(i=1;i<=n;i++){
for(j=1;j<=m;j++){
if(s[i][j]=='J'){
x=0;
y=0;
for(l=j+1;l<=m;l++) if(s[i][l]=='O') x++;
for(k=i+1;k<=n;k++) if(s[k][j]=='I') y++;
ans+=x*y;
}
}
}
cout << ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
704 KB |
Output is correct |
7 |
Correct |
1 ms |
600 KB |
Output is correct |
8 |
Correct |
1 ms |
540 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
704 KB |
Output is correct |
7 |
Correct |
1 ms |
600 KB |
Output is correct |
8 |
Correct |
1 ms |
540 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
604 KB |
Output is correct |
14 |
Correct |
27 ms |
1952 KB |
Output is correct |
15 |
Correct |
2 ms |
1628 KB |
Output is correct |
16 |
Correct |
17 ms |
1328 KB |
Output is correct |
17 |
Correct |
0 ms |
432 KB |
Output is correct |
18 |
Correct |
37 ms |
2136 KB |
Output is correct |
19 |
Correct |
14 ms |
2140 KB |
Output is correct |
20 |
Correct |
43 ms |
1884 KB |
Output is correct |
21 |
Correct |
33 ms |
2136 KB |
Output is correct |
22 |
Correct |
32 ms |
2068 KB |
Output is correct |
23 |
Correct |
41 ms |
1884 KB |
Output is correct |
24 |
Correct |
41 ms |
2136 KB |
Output is correct |
25 |
Correct |
15 ms |
2136 KB |
Output is correct |
26 |
Correct |
39 ms |
1884 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
704 KB |
Output is correct |
7 |
Correct |
1 ms |
600 KB |
Output is correct |
8 |
Correct |
1 ms |
540 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
604 KB |
Output is correct |
14 |
Correct |
27 ms |
1952 KB |
Output is correct |
15 |
Correct |
2 ms |
1628 KB |
Output is correct |
16 |
Correct |
17 ms |
1328 KB |
Output is correct |
17 |
Correct |
0 ms |
432 KB |
Output is correct |
18 |
Correct |
37 ms |
2136 KB |
Output is correct |
19 |
Correct |
14 ms |
2140 KB |
Output is correct |
20 |
Correct |
43 ms |
1884 KB |
Output is correct |
21 |
Correct |
33 ms |
2136 KB |
Output is correct |
22 |
Correct |
32 ms |
2068 KB |
Output is correct |
23 |
Correct |
41 ms |
1884 KB |
Output is correct |
24 |
Correct |
41 ms |
2136 KB |
Output is correct |
25 |
Correct |
15 ms |
2136 KB |
Output is correct |
26 |
Correct |
39 ms |
1884 KB |
Output is correct |
27 |
Execution timed out |
1051 ms |
17444 KB |
Time limit exceeded |
28 |
Halted |
0 ms |
0 KB |
- |