Submission #716212

# Submission time Handle Problem Language Result Execution time Memory
716212 2023-03-29T08:57:05 Z Syrupy22 Bitaro the Brave (JOI19_ho_t1) C++14
0 / 100
0 ms 212 KB
#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 time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -