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;
using ll = long long;
using vi = vector<int>;
int main() {
cin.tie(0);
ios_base::sync_with_stdio(0);
int h, w;
cin >> h >> w;
vector<string> S(h);
for(int i = 0; i < h; ++i) {
cin >> S[i];
reverse(S[i].begin(), S[i].end());
}
reverse(S.begin(), S.end());
vi Fi(h, 0), Fj(w, 0);
ll re = 0;
for(int i = 0; i < h; ++i)
for(int j = 0; j < w; ++j) {
if(S[i][j] == 'O') ++Fi[i];
if(S[i][j] == 'I') ++Fj[j];
if(S[i][j] == 'J') {
int cre = Fi[i] * Fj[j];
if(cre)
re += cre;
}
}
cout << re << "\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |