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 vll = vector <ll>;
int main () {
cin.tie(nullptr) -> sync_with_stdio(false);
ll n, m;
cin >> n >> m;
vll dp(m, 0);
ll ans = 0;
for (ll i = 0; i < n; i++) {
string str;
cin >> str;
ll acc = 0;
for (ll j = m-1; j >= 0; j--) {
switch (str[j]) {
case 'J':
dp[j] += acc;
break;
case 'O':
acc++;
break;
case 'I':
ans += dp[j];
break;
}
}
}
cout << ans << '\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... |