답안 #818771

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
818771 2023-08-10T06:42:01 Z Zanite Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
299 ms 80236 KB
#include <bits/stdc++.h>
using namespace std;

const int maxN	= 3023;

int H, W;
char grid[maxN][maxN];
int O[maxN][maxN], I[maxN][maxN];

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);

	cin >> H >> W;
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			cin >> grid[i][j];
		}
	}

	for (int i = 1; i <= H; i++) {
		for (int j = W; j >= 1; j--) {
			O[i][j] = O[i][j+1] + (grid[i][j] == 'O');
		}
	}

	for (int j = 1; j <= W; j++) {
		for (int i = H; i >= 1; i--) {
			I[i][j] = I[i+1][j] + (grid[i][j] == 'I');
		}
	}

	long long ans = 0;
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			if (grid[i][j] == 'J') {
				ans += 1ll * O[i][j] * I[i][j];
			}
		}
	}
	cout << ans << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1312 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1312 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 6 ms 7252 KB Output is correct
15 Correct 2 ms 4948 KB Output is correct
16 Correct 3 ms 4180 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Correct 7 ms 7764 KB Output is correct
19 Correct 7 ms 7636 KB Output is correct
20 Correct 6 ms 7508 KB Output is correct
21 Correct 7 ms 7684 KB Output is correct
22 Correct 7 ms 7600 KB Output is correct
23 Correct 6 ms 7508 KB Output is correct
24 Correct 8 ms 7764 KB Output is correct
25 Correct 7 ms 7700 KB Output is correct
26 Correct 7 ms 7508 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1312 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 6 ms 7252 KB Output is correct
15 Correct 2 ms 4948 KB Output is correct
16 Correct 3 ms 4180 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Correct 7 ms 7764 KB Output is correct
19 Correct 7 ms 7636 KB Output is correct
20 Correct 6 ms 7508 KB Output is correct
21 Correct 7 ms 7684 KB Output is correct
22 Correct 7 ms 7600 KB Output is correct
23 Correct 6 ms 7508 KB Output is correct
24 Correct 8 ms 7764 KB Output is correct
25 Correct 7 ms 7700 KB Output is correct
26 Correct 7 ms 7508 KB Output is correct
27 Correct 289 ms 80112 KB Output is correct
28 Correct 15 ms 26068 KB Output is correct
29 Correct 12 ms 7168 KB Output is correct
30 Correct 1 ms 596 KB Output is correct
31 Correct 207 ms 66784 KB Output is correct
32 Correct 265 ms 80236 KB Output is correct
33 Correct 271 ms 79820 KB Output is correct
34 Correct 245 ms 77452 KB Output is correct
35 Correct 269 ms 80100 KB Output is correct
36 Correct 267 ms 79896 KB Output is correct
37 Correct 299 ms 80204 KB Output is correct
38 Correct 190 ms 66816 KB Output is correct
39 Correct 188 ms 66552 KB Output is correct