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;
const int nx=3e3+5;
int h, w, dpr[nx], dpc[nx];
long long ans;
char c;
vector<pair<int, int>> v;
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>h>>w;
for (int i=1; i<=h; i++)
{
for (int j=1; j<=w; j++)
{
cin>>c;
if (c=='J') v.push_back({i, j});
if (c=='O') dpr[i]++;
if (c=='I') dpc[j]++;
}
}
for (auto [x, y]:v) ans+=dpr[y]*dpc[x];
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... |