#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 |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |