#include<bits/stdc++.h>
using namespace std;
char ma[3001][3001];
vector <pair<long long,long long >> doo;
vector <pair<long long,long long >> dii;
int main(){
long long 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]=='O')
doo.push_back({i,j});
else if(ma[i][j]=='I')
dii.push_back({i,j});
}
}
for(pair<int,int> x:doo){
long long tw=x.first;
long long tw2=x.second;
for(pair<int,int> y:dii){
long long on=y.second;
long long on1=y.first;
if(tw2<=on||on1<=tw)
continue;
if(ma[tw][on]=='J')
ans++;
}
}
cout<<ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 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 |
13 ms |
740 KB |
Output is correct |
6 |
Correct |
13 ms |
724 KB |
Output is correct |
7 |
Correct |
11 ms |
724 KB |
Output is correct |
8 |
Correct |
13 ms |
852 KB |
Output is correct |
9 |
Correct |
9 ms |
724 KB |
Output is correct |
10 |
Correct |
12 ms |
724 KB |
Output is correct |
11 |
Correct |
15 ms |
724 KB |
Output is correct |
12 |
Correct |
12 ms |
732 KB |
Output is correct |
13 |
Correct |
12 ms |
724 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 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 |
13 ms |
740 KB |
Output is correct |
6 |
Correct |
13 ms |
724 KB |
Output is correct |
7 |
Correct |
11 ms |
724 KB |
Output is correct |
8 |
Correct |
13 ms |
852 KB |
Output is correct |
9 |
Correct |
9 ms |
724 KB |
Output is correct |
10 |
Correct |
12 ms |
724 KB |
Output is correct |
11 |
Correct |
15 ms |
724 KB |
Output is correct |
12 |
Correct |
12 ms |
732 KB |
Output is correct |
13 |
Correct |
12 ms |
724 KB |
Output is correct |
14 |
Execution timed out |
1082 ms |
3904 KB |
Time limit exceeded |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 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 |
13 ms |
740 KB |
Output is correct |
6 |
Correct |
13 ms |
724 KB |
Output is correct |
7 |
Correct |
11 ms |
724 KB |
Output is correct |
8 |
Correct |
13 ms |
852 KB |
Output is correct |
9 |
Correct |
9 ms |
724 KB |
Output is correct |
10 |
Correct |
12 ms |
724 KB |
Output is correct |
11 |
Correct |
15 ms |
724 KB |
Output is correct |
12 |
Correct |
12 ms |
732 KB |
Output is correct |
13 |
Correct |
12 ms |
724 KB |
Output is correct |
14 |
Execution timed out |
1082 ms |
3904 KB |
Time limit exceeded |
15 |
Halted |
0 ms |
0 KB |
- |