This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |