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 MAX = 3e3 + 5;
int n, m, f[MAX];
char a[MAX][MAX];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
for(int i = 1; i <= n; ++i){
for(int j = 1; j <= m; ++j){
cin >> a[i][j];
}
}
long long ans = 0;
for(int j = m; j >= 1; --j){
int sum = 0;
for(int i = 1; i <= n; ++i){
if(a[i][j] == 'J'){
sum += f[i];
}
else if(a[i][j] == 'O'){
++f[i];
}
else{
ans += sum;
}
}
}
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... |