이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(int argc, char const *argv[]){
cin.tie(0), ios::sync_with_stdio(0);
ll h, w;
cin >> h >> w;
char grid[h][w];
for(ll i = 0; i < h; i++){
for(ll k = 0; k < w; k++)
cin >> grid[i][k];
}
ll ingot[h][w] = {0}, orb[h][w] = {0};
for(ll i = 0; i < w; i++){
ll counter = 0;
for(ll k = h - 1; k >= 0; k--){
if(grid[k][i] == 'I')
counter++;
ingot[k][i] = counter;
}
}
for(ll i = 0; i < h; i++){
ll counter = 0;
for(ll k = w - 1; k >= 0; k--){
if(grid[i][k] == 'O')
counter++;
orb[i][k] = counter;
}
}
ll res = 0;
for(ll i = 0; i < h; i++){
for(ll k = 0; k < w; k++){
if(grid[i][k] == 'J')
res += orb[i][k] * ingot[i][k];
}
}
cout << res;
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... |