Submission #716212

#TimeUsernameProblemLanguageResultExecution timeMemory
716212Syrupy22Bitaro the Brave (JOI19_ho_t1)C++14
0 / 100
0 ms212 KiB
#include<bits/stdc++.h> using namespace std; int main(){ int h, w; cin >> h >> w; char grid [h + 1][w + 1]; for(int i = 1; i <= h; i++){ for(int j = 0; j <= w; j++) cin >> grid[i][j]; } pair<int, pair<int, int> > dp[h + 2][w + 2]; for(int i = 0; i < h + 2; i++) dp[i][w + 1] = make_pair(0, make_pair(0, 0)); for(int i = 0; i < w + 2; i++) dp[0][i] = make_pair(0, make_pair(0, 0)); for(int i = 1; i <= h; i++){ for(int j = w; j > 0; j++){ int noOfO = dp[i][w - 1].second.second; if(grid[i][j] == 'O') noOfO += 1; int noOfJo = dp[i-1][w].second.first; if(grid[i][j] == 'J') noOfJo += noOfO; int pow = dp[i-1][w].first; if(grid[i][j] == 'I') pow += noOfJo; } } int ans = 0; for(int i = 1; i <= w; i++) ans += dp[h][i].first; cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...