이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// 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... |