제출 #208411

#제출 시각아이디문제언어결과실행 시간메모리
208411zhacatomnBitaro the Brave (JOI19_ho_t1)C++14
50 / 100
1066 ms150340 KiB
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]){ int h, w; cin >> h >> w; char grid[h][w]; for(int i = 0; i < h; i++){ for(int k = 0; k < w; k++) cin >> grid[i][k]; } long long ingot[h][w] = {0}, orb[h][w] = {0}; for(int i = 0; i < w; i++){ int counter = 0; for(int k = h - 1; k >= 0; k--){ if(grid[k][i] == 'I') counter++; ingot[k][i] = counter; } } for(int i = 0; i < h; i++){ int counter = 0; for(int k = w - 1; k >= 0; k--){ if(grid[i][k] == 'O') counter++; orb[i][k] = counter; } } long long res = 0; for(int i = 0; i < h; i++){ for(int k = 0; k < w; k++){ if(grid[i][k] == 'J') res += orb[i][k] * ingot[i][k]; } } cout << res; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...