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
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define mp make_pair
#define pb push_back
using namespace std;
int n, m, rez = 0;
char mat[3030][3030];
int main(){
cin>>n>>m;
for(int i = 0; i < n; i++){
string a;
cin>>a;
for(int j = 0; j < m; j++){
mat[i][j] = a[j];
}
}
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
if(mat[i][j] == 'J'){
int lcnt = 0, kcnt = 0;
for(int l = j + 1; l < m; l++){
if(mat[i][l] == 'O'){
lcnt++;
}
else
continue;
}
for(int k = i + 1; k < n; k++){
if(mat[k][j] == 'I'){
kcnt++;
}
else
continue;
}
rez += (kcnt * lcnt);
}
else
continue;
}
}
cout<<rez<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |