답안 #411741

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
411741 2021-05-25T20:24:22 Z nichke Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
199 ms 160068 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'

int ans;
int h, w;
string ar[3005];
int suff[3005][3005][2];

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		cin >> ar[i];
	}
	for (int i = 0; i < h; i++) {
		for (int j = w - 1; j >= 0; j--) {
			suff[i][j][0] = suff[i][j + 1][0];
			suff[i][j][0] += (ar[i][j] == 'O');
		}
	}
	for (int i = h - 1; i >= 0; i--) {
		for (int j = 0; j < w; j++) {
			suff[i][j][1] = suff[i + 1][j][1];
			suff[i][j][1] += (ar[i][j] == 'I');
		}
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (ar[i][j] == 'J') {
				ans += suff[i][j][0] * suff[i][j][1];
			}
		}			
	}
	cout << ans << '\n';
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 2 ms 940 KB Output is correct
6 Correct 2 ms 844 KB Output is correct
7 Correct 1 ms 844 KB Output is correct
8 Correct 2 ms 940 KB Output is correct
9 Correct 1 ms 844 KB Output is correct
10 Correct 1 ms 844 KB Output is correct
11 Correct 1 ms 944 KB Output is correct
12 Correct 1 ms 844 KB Output is correct
13 Correct 1 ms 844 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 2 ms 940 KB Output is correct
6 Correct 2 ms 844 KB Output is correct
7 Correct 1 ms 844 KB Output is correct
8 Correct 2 ms 940 KB Output is correct
9 Correct 1 ms 844 KB Output is correct
10 Correct 1 ms 844 KB Output is correct
11 Correct 1 ms 944 KB Output is correct
12 Correct 1 ms 844 KB Output is correct
13 Correct 1 ms 844 KB Output is correct
14 Correct 8 ms 5804 KB Output is correct
15 Correct 3 ms 2124 KB Output is correct
16 Correct 4 ms 3760 KB Output is correct
17 Correct 1 ms 416 KB Output is correct
18 Correct 9 ms 6868 KB Output is correct
19 Correct 9 ms 6672 KB Output is correct
20 Correct 7 ms 6604 KB Output is correct
21 Correct 10 ms 6860 KB Output is correct
22 Correct 7 ms 6604 KB Output is correct
23 Correct 6 ms 6692 KB Output is correct
24 Correct 9 ms 6864 KB Output is correct
25 Correct 7 ms 6604 KB Output is correct
26 Correct 6 ms 6620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 2 ms 940 KB Output is correct
6 Correct 2 ms 844 KB Output is correct
7 Correct 1 ms 844 KB Output is correct
8 Correct 2 ms 940 KB Output is correct
9 Correct 1 ms 844 KB Output is correct
10 Correct 1 ms 844 KB Output is correct
11 Correct 1 ms 944 KB Output is correct
12 Correct 1 ms 844 KB Output is correct
13 Correct 1 ms 844 KB Output is correct
14 Correct 8 ms 5804 KB Output is correct
15 Correct 3 ms 2124 KB Output is correct
16 Correct 4 ms 3760 KB Output is correct
17 Correct 1 ms 416 KB Output is correct
18 Correct 9 ms 6868 KB Output is correct
19 Correct 9 ms 6672 KB Output is correct
20 Correct 7 ms 6604 KB Output is correct
21 Correct 10 ms 6860 KB Output is correct
22 Correct 7 ms 6604 KB Output is correct
23 Correct 6 ms 6692 KB Output is correct
24 Correct 9 ms 6864 KB Output is correct
25 Correct 7 ms 6604 KB Output is correct
26 Correct 6 ms 6620 KB Output is correct
27 Correct 188 ms 158940 KB Output is correct
28 Correct 9 ms 10276 KB Output is correct
29 Correct 12 ms 12820 KB Output is correct
30 Correct 2 ms 844 KB Output is correct
31 Correct 131 ms 121012 KB Output is correct
32 Correct 160 ms 159912 KB Output is correct
33 Correct 170 ms 159540 KB Output is correct
34 Correct 162 ms 140296 KB Output is correct
35 Correct 165 ms 159936 KB Output is correct
36 Correct 163 ms 159468 KB Output is correct
37 Correct 199 ms 160068 KB Output is correct
38 Correct 122 ms 120148 KB Output is correct
39 Correct 107 ms 120516 KB Output is correct