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 <iostream>
#include <vector>
using namespace std;
int main(){
int h,w;
cin>>h>>w;
char grid[h][w];
vector<pair<int,int> > v;
vector<int> ie(w,0);
vector<int> o(h,0);
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
cin>>grid[i][j];
if(grid[i][j]=='J')v.push_back(make_pair(i,j));
if(grid[i][j]=='I')ie[j]++;
if(grid[i][j]=='O')o[i]++;
}
}
int n=v.size();
int sol=0;
for(int j=0;j<n;j++){
int x=v[j].first;
int y=v[j].second;
sol+=ie[x]*o[y];
}
cout<<sol<<'\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |