Submission #679482

# Submission time Handle Problem Language Result Execution time Memory
679482 2023-01-08T12:02:23 Z ethening Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
225 ms 89544 KB
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

int main() {
	cin.tie(0)->sync_with_stdio(0);
	int n, m;
	cin >> n >> m;
	vector<string> s(n);
	for (auto &o: s) {
		cin >> o;
	}
	vector oki(n, vector<int>(m, 0));
	vector oko(n, vector<int>(m, 0));
	for (int i = 0; i < m; i++) {
		int cnti = 0;
		for (int j = n - 1; j >= 0; j--) {
			if (s[j][i] == 'I') ++cnti;
			else if (s[j][i] == 'J') oki[j][i] = cnti;
		}
	}
	for (int i = 0; i < n; i++) {
		int cnto = 0;
		for (int j = m - 1; j >= 0; j--) {
			if (s[i][j] == 'O') ++cnto;
			else if (s[i][j] == 'J') oko[i][j] = cnto;
		}
	}

	ll ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			ans += oki[i][j] * oko[i][j];
		}
	}
	cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 5 ms 2260 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 2 ms 1592 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 6 ms 2764 KB Output is correct
19 Correct 3 ms 2724 KB Output is correct
20 Correct 3 ms 2772 KB Output is correct
21 Correct 5 ms 2840 KB Output is correct
22 Correct 3 ms 2636 KB Output is correct
23 Correct 3 ms 2692 KB Output is correct
24 Correct 6 ms 2772 KB Output is correct
25 Correct 3 ms 2628 KB Output is correct
26 Correct 3 ms 2772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 5 ms 2260 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 2 ms 1592 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 6 ms 2764 KB Output is correct
19 Correct 3 ms 2724 KB Output is correct
20 Correct 3 ms 2772 KB Output is correct
21 Correct 5 ms 2840 KB Output is correct
22 Correct 3 ms 2636 KB Output is correct
23 Correct 3 ms 2692 KB Output is correct
24 Correct 6 ms 2772 KB Output is correct
25 Correct 3 ms 2628 KB Output is correct
26 Correct 3 ms 2772 KB Output is correct
27 Correct 211 ms 84604 KB Output is correct
28 Correct 1 ms 788 KB Output is correct
29 Correct 6 ms 6716 KB Output is correct
30 Correct 1 ms 456 KB Output is correct
31 Correct 150 ms 62208 KB Output is correct
32 Correct 124 ms 89104 KB Output is correct
33 Correct 157 ms 89420 KB Output is correct
34 Correct 177 ms 72068 KB Output is correct
35 Correct 143 ms 89008 KB Output is correct
36 Correct 138 ms 89240 KB Output is correct
37 Correct 225 ms 89544 KB Output is correct
38 Correct 75 ms 61692 KB Output is correct
39 Correct 94 ms 62020 KB Output is correct