#include<bits/stdc++.h>
using namespace std;
char ma[3001][3001];
vector <pair<int,int>> di;
int main(){
int n,m,i,j,ans=0;
cin>>n>>m;
string s;
for( i=0;i<n;i++){
cin>>s;
for( j=0;j<m;j++)
ma[i][j]=s[j];
}
for(i=0;i<n;i++){
for(int j=0;j<m;j++){
if(ma[i][j]=='J')
di.push_back({i,j});
}
}
for(pair<int,int> x:di){
int tw=x.first;
int on=x.second;
int s1=0,s2=0;
for(i=on+1;i<m;i++){
if(ma[tw][i]=='O')
s1++;
}
for(i=tw+1;i<n;i++){
if(ma[i][on]=='I')
s2++;
}
ans+=s1*s2;
}
cout<<ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
596 KB |
Output is correct |
6 |
Correct |
1 ms |
596 KB |
Output is correct |
7 |
Correct |
1 ms |
596 KB |
Output is correct |
8 |
Correct |
1 ms |
596 KB |
Output is correct |
9 |
Correct |
1 ms |
596 KB |
Output is correct |
10 |
Correct |
1 ms |
596 KB |
Output is correct |
11 |
Correct |
1 ms |
596 KB |
Output is correct |
12 |
Correct |
1 ms |
596 KB |
Output is correct |
13 |
Correct |
1 ms |
596 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
596 KB |
Output is correct |
6 |
Correct |
1 ms |
596 KB |
Output is correct |
7 |
Correct |
1 ms |
596 KB |
Output is correct |
8 |
Correct |
1 ms |
596 KB |
Output is correct |
9 |
Correct |
1 ms |
596 KB |
Output is correct |
10 |
Correct |
1 ms |
596 KB |
Output is correct |
11 |
Correct |
1 ms |
596 KB |
Output is correct |
12 |
Correct |
1 ms |
596 KB |
Output is correct |
13 |
Correct |
1 ms |
596 KB |
Output is correct |
14 |
Correct |
34 ms |
2324 KB |
Output is correct |
15 |
Correct |
2 ms |
1544 KB |
Output is correct |
16 |
Correct |
18 ms |
1644 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
41 ms |
2936 KB |
Output is correct |
19 |
Correct |
15 ms |
2152 KB |
Output is correct |
20 |
Incorrect |
54 ms |
2904 KB |
Output isn't correct |
21 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
596 KB |
Output is correct |
6 |
Correct |
1 ms |
596 KB |
Output is correct |
7 |
Correct |
1 ms |
596 KB |
Output is correct |
8 |
Correct |
1 ms |
596 KB |
Output is correct |
9 |
Correct |
1 ms |
596 KB |
Output is correct |
10 |
Correct |
1 ms |
596 KB |
Output is correct |
11 |
Correct |
1 ms |
596 KB |
Output is correct |
12 |
Correct |
1 ms |
596 KB |
Output is correct |
13 |
Correct |
1 ms |
596 KB |
Output is correct |
14 |
Correct |
34 ms |
2324 KB |
Output is correct |
15 |
Correct |
2 ms |
1544 KB |
Output is correct |
16 |
Correct |
18 ms |
1644 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
41 ms |
2936 KB |
Output is correct |
19 |
Correct |
15 ms |
2152 KB |
Output is correct |
20 |
Incorrect |
54 ms |
2904 KB |
Output isn't correct |
21 |
Halted |
0 ms |
0 KB |
- |