답안 #853968

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
853968 2023-09-25T17:24:57 Z parsadox2 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
153 ms 88660 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 3e3 + 2;
int h , w , dpo[N][N] , dpi[N][N];
char c[N][N];

signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);  cout.tie(0);
	cin >> h >> w;
	for(int i = 0 ; i < h ; i++)  for(int j = 0 ; j < w ; j++)
		cin >> c[i][j];
	long long ans = 0;
	for(int i = h - 1 ; i >= 0 ; i--)  for(int j = w - 1 ; j >= 0 ; j--)
	{
		dpi[i][j] = (i == h - 1 ? 0 : dpi[i + 1][j]);
		if(c[i][j] == 'I')
			dpi[i][j]++;
		dpo[i][j] = (j == w - 1 ? 0 : dpo[i][j + 1]);
		if(c[i][j] == 'O')
			dpo[i][j]++;
		if(c[i][j] == 'J')
			ans += dpi[i][j] * dpo[i][j];
	}
	cout << ans << '\n';
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4560 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 6748 KB Output is correct
6 Correct 1 ms 6748 KB Output is correct
7 Correct 1 ms 6748 KB Output is correct
8 Correct 1 ms 6748 KB Output is correct
9 Correct 1 ms 6744 KB Output is correct
10 Correct 1 ms 6748 KB Output is correct
11 Correct 1 ms 6616 KB Output is correct
12 Correct 1 ms 6748 KB Output is correct
13 Correct 1 ms 6748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4560 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 6748 KB Output is correct
6 Correct 1 ms 6748 KB Output is correct
7 Correct 1 ms 6748 KB Output is correct
8 Correct 1 ms 6748 KB Output is correct
9 Correct 1 ms 6744 KB Output is correct
10 Correct 1 ms 6748 KB Output is correct
11 Correct 1 ms 6616 KB Output is correct
12 Correct 1 ms 6748 KB Output is correct
13 Correct 1 ms 6748 KB Output is correct
14 Correct 5 ms 19292 KB Output is correct
15 Correct 2 ms 14800 KB Output is correct
16 Correct 3 ms 10844 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 6 ms 19276 KB Output is correct
19 Correct 5 ms 19292 KB Output is correct
20 Correct 5 ms 19292 KB Output is correct
21 Correct 6 ms 19288 KB Output is correct
22 Correct 5 ms 19292 KB Output is correct
23 Correct 5 ms 19344 KB Output is correct
24 Correct 6 ms 19288 KB Output is correct
25 Correct 5 ms 19292 KB Output is correct
26 Correct 5 ms 19292 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4560 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 6748 KB Output is correct
6 Correct 1 ms 6748 KB Output is correct
7 Correct 1 ms 6748 KB Output is correct
8 Correct 1 ms 6748 KB Output is correct
9 Correct 1 ms 6744 KB Output is correct
10 Correct 1 ms 6748 KB Output is correct
11 Correct 1 ms 6616 KB Output is correct
12 Correct 1 ms 6748 KB Output is correct
13 Correct 1 ms 6748 KB Output is correct
14 Correct 5 ms 19292 KB Output is correct
15 Correct 2 ms 14800 KB Output is correct
16 Correct 3 ms 10844 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 6 ms 19276 KB Output is correct
19 Correct 5 ms 19292 KB Output is correct
20 Correct 5 ms 19292 KB Output is correct
21 Correct 6 ms 19288 KB Output is correct
22 Correct 5 ms 19292 KB Output is correct
23 Correct 5 ms 19344 KB Output is correct
24 Correct 6 ms 19288 KB Output is correct
25 Correct 5 ms 19292 KB Output is correct
26 Correct 5 ms 19292 KB Output is correct
27 Correct 153 ms 87912 KB Output is correct
28 Correct 7 ms 66136 KB Output is correct
29 Correct 9 ms 11356 KB Output is correct
30 Correct 1 ms 4700 KB Output is correct
31 Correct 103 ms 76392 KB Output is correct
32 Correct 107 ms 88432 KB Output is correct
33 Correct 117 ms 88660 KB Output is correct
34 Correct 119 ms 85880 KB Output is correct
35 Correct 109 ms 88428 KB Output is correct
36 Correct 102 ms 88416 KB Output is correct
37 Correct 141 ms 88552 KB Output is correct
38 Correct 76 ms 76768 KB Output is correct
39 Correct 73 ms 76376 KB Output is correct