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>
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |