이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int MAXH = 3000;
string v[MAXH];
int ingots[MAXH];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int h, w, i, j, orbs;
long long ans;
cin >> h >> w;
for(i = 0; i < h; i++){
cin >> v[i];
}
ans = 0;
for(i = h - 1; i >= 0; i--){
orbs = 0;
for(j = w - 1; j >= 0; j--){
switch(v[i][j]){
case 'O':
++orbs;
break;
case 'I':
++ingots[j];
break;
case 'J':
ans += 1LL * orbs * ingots[j];
break;
}
}
}
cout << ans;
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... |