이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define ff first
#define ss second
#define int long long
#define all(x) x.begin(), x.end()
const int maxn = 3e3 + 5;
int va[maxn];
char mtx[maxn][maxn];
int32_t main(){
int h, w; cin >> h >> w;
for(int i = 0; i < h; i++){
for(int j = 0; j < w; j++){
cin >> mtx[i][j];
}
}
int ans = 0;
for(int i = 0; i < w; i++){
for(int j = h-1; j >= 0; j--){
if(mtx[j][i]=='O') ans += va[j];
}
int ingots = 0;
for(int j = h-1; j >= 0; j--){
if(mtx[j][i]=='I') ingots++;
else if(mtx[j][i]=='J') va[j] += ingots;
}
}
cout << ans << '\n';
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |