This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Online C++ compiler to run C++ program online
#include <bits/stdc++.h>
using namespace std;
char a[3005][3005];
pair<int,int> x[3005][3005];
int main() {
// Write C++ code here
int n, m;
long long k = 0ll;
cin >> n >> m;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
cin >> a[i][j];
}
}
for(int i = n; i; i--){
for(int j = m; j; j--){
x[i][j].first = x[i+1][j].first;
x[i][j].second = x[i][j+1].second;
if(a[i][j] == 'I')x[i][j].first++;
if(a[i][j] == 'O')x[i][j].second++;
if(a[i][j] == 'J')k += x[i][j].first * x[i][j].second;
}
}
cout << k;
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... |