답안 #1031670

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1031670 2024-07-23T03:33:46 Z juicy Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
91 ms 54588 KB
#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);

	int N, M; cin >> N >> M;
	vector<string> S(N);
	for (int i = 0; i < N; ++i) {
		cin >> S[i];
	}
	vector sf(M, vector<int>(N));
	for (int i = 0; i < M; ++i) {
		sf[i][N - 1] = S[N - 1][i] == 'I';
		for (int j = N - 2; j >= 0; --j) {
			sf[i][j] = sf[i][j + 1] + (S[j][i] == 'I');
		}
	}
	long long res = 0;
	for (int i = 0; i < N; ++i) {
		for (int j = M - 1, cnt = 0; j >= 0; --j) {
			cnt += S[i][j] == 'O';
			if (S[i][j] == 'J') {
				res += cnt * sf[j][i];
			}
		}
	}
	cout << res;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 2 ms 1624 KB Output is correct
15 Correct 0 ms 460 KB Output is correct
16 Correct 1 ms 1116 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 2 ms 1976 KB Output is correct
19 Correct 2 ms 1884 KB Output is correct
20 Correct 3 ms 1884 KB Output is correct
21 Correct 2 ms 2136 KB Output is correct
22 Correct 2 ms 1880 KB Output is correct
23 Correct 2 ms 1884 KB Output is correct
24 Correct 2 ms 1884 KB Output is correct
25 Correct 2 ms 1884 KB Output is correct
26 Correct 1 ms 1884 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 2 ms 1624 KB Output is correct
15 Correct 0 ms 460 KB Output is correct
16 Correct 1 ms 1116 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 2 ms 1976 KB Output is correct
19 Correct 2 ms 1884 KB Output is correct
20 Correct 3 ms 1884 KB Output is correct
21 Correct 2 ms 2136 KB Output is correct
22 Correct 2 ms 1880 KB Output is correct
23 Correct 2 ms 1884 KB Output is correct
24 Correct 2 ms 1884 KB Output is correct
25 Correct 2 ms 1884 KB Output is correct
26 Correct 1 ms 1884 KB Output is correct
27 Correct 81 ms 51280 KB Output is correct
28 Correct 1 ms 604 KB Output is correct
29 Correct 4 ms 4440 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 56 ms 37812 KB Output is correct
32 Correct 65 ms 53836 KB Output is correct
33 Correct 62 ms 54588 KB Output is correct
34 Correct 67 ms 43728 KB Output is correct
35 Correct 70 ms 53852 KB Output is correct
36 Correct 61 ms 53988 KB Output is correct
37 Correct 91 ms 54428 KB Output is correct
38 Correct 48 ms 37468 KB Output is correct
39 Correct 40 ms 37456 KB Output is correct