답안 #159382

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
159382 2019-10-22T14:15:49 Z iefnah06 Bitaro the Brave (JOI19_ho_t1) C++11
100 / 100
144 ms 88716 KB
#include<bits/stdc++.h>
using namespace std;

using ll = long long;

const int MAXH = 3010;
const int MAXW = 3010;
int H, W;
char G[MAXH][MAXW];

int sumO[MAXH][MAXW];
int sumI[MAXH][MAXW];

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> H >> W;
	for (int i = 0; i < H; i++) {
		cin >> G[i];
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			sumO[i][j+1] = sumO[i][j] + (G[i][j] == 'O');
		}
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			sumI[i+1][j] = sumI[i][j] + (G[i][j] == 'I');
		}
	}
	ll ans = 0;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (G[i][j] == 'J') {
				ans += (sumO[i][W] - sumO[i][j]) * (sumI[H][j] - sumI[i][j]);
			}
		}
	}
	cout << ans << '\n';

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 3 ms 1528 KB Output is correct
6 Correct 3 ms 1528 KB Output is correct
7 Correct 3 ms 1400 KB Output is correct
8 Correct 3 ms 1528 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 3 ms 1400 KB Output is correct
11 Correct 4 ms 1528 KB Output is correct
12 Correct 3 ms 1528 KB Output is correct
13 Correct 4 ms 1400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 3 ms 1528 KB Output is correct
6 Correct 3 ms 1528 KB Output is correct
7 Correct 3 ms 1400 KB Output is correct
8 Correct 3 ms 1528 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 3 ms 1400 KB Output is correct
11 Correct 4 ms 1528 KB Output is correct
12 Correct 3 ms 1528 KB Output is correct
13 Correct 4 ms 1400 KB Output is correct
14 Correct 15 ms 7544 KB Output is correct
15 Correct 7 ms 4984 KB Output is correct
16 Correct 6 ms 4344 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 12 ms 8056 KB Output is correct
19 Correct 10 ms 7928 KB Output is correct
20 Correct 10 ms 7928 KB Output is correct
21 Correct 12 ms 8056 KB Output is correct
22 Correct 10 ms 7932 KB Output is correct
23 Correct 10 ms 7928 KB Output is correct
24 Correct 11 ms 8060 KB Output is correct
25 Correct 10 ms 7928 KB Output is correct
26 Correct 10 ms 7932 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 3 ms 1528 KB Output is correct
6 Correct 3 ms 1528 KB Output is correct
7 Correct 3 ms 1400 KB Output is correct
8 Correct 3 ms 1528 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 3 ms 1400 KB Output is correct
11 Correct 4 ms 1528 KB Output is correct
12 Correct 3 ms 1528 KB Output is correct
13 Correct 4 ms 1400 KB Output is correct
14 Correct 15 ms 7544 KB Output is correct
15 Correct 7 ms 4984 KB Output is correct
16 Correct 6 ms 4344 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 12 ms 8056 KB Output is correct
19 Correct 10 ms 7928 KB Output is correct
20 Correct 10 ms 7928 KB Output is correct
21 Correct 12 ms 8056 KB Output is correct
22 Correct 10 ms 7932 KB Output is correct
23 Correct 10 ms 7928 KB Output is correct
24 Correct 11 ms 8060 KB Output is correct
25 Correct 10 ms 7928 KB Output is correct
26 Correct 10 ms 7932 KB Output is correct
27 Correct 135 ms 88212 KB Output is correct
28 Correct 31 ms 26104 KB Output is correct
29 Correct 11 ms 7928 KB Output is correct
30 Correct 3 ms 632 KB Output is correct
31 Correct 110 ms 72824 KB Output is correct
32 Correct 104 ms 88568 KB Output is correct
33 Correct 101 ms 88312 KB Output is correct
34 Correct 124 ms 84348 KB Output is correct
35 Correct 106 ms 88716 KB Output is correct
36 Correct 104 ms 88440 KB Output is correct
37 Correct 144 ms 88696 KB Output is correct
38 Correct 91 ms 72668 KB Output is correct
39 Correct 88 ms 72412 KB Output is correct