Submission #209207

#TimeUsernameProblemLanguageResultExecution timeMemory
209207origami100Bitaro the Brave (JOI19_ho_t1)C++11
20 / 100
21 ms2680 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int h, w; cin >> h >> w; vector <string> grid; for(int i = 0; i < h; i++){ string s; cin >> s; grid.push_back(s); } int O[h][w], I[h][w]; for(int i = 0; i < h; i++){ O[i][w - 1] = (grid[i][w - 1] == 'O')?1:0; } for(int i = 0; i < w; i++){ I[h - 1][i] = (grid[h - 1][i] == 'I')?1:0; } int cnt = 0; for(int i = h - 2; i >= 0; i--){ for(int j = w - 2; j >= 0; j--){ switch(grid[i][j]){ case 'J': I[i][j] = I[i + 1][j]; O[i][j] = O[i][j + 1]; cnt += I[i][j] * O[i][j]; break; case 'O': I[i][j] = I[i + 1][j]; O[i][j] = O[i][j + 1] + 1; break; case 'I': I[i][j] = I[i + 1][j] + 1; O[i][j] = O[i][j + 1]; break; } } } cout << cnt; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...