Submission #710525

# Submission time Handle Problem Language Result Execution time Memory
710525 2023-03-15T10:14:14 Z yellowtoad Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
734 ms 159424 KB
#include <iostream>
using namespace std;

long long n, m, psx[3010][3010], psy[3010][3010], ans;
char c[3010][3010];

int main() {
	cin >> n >> m;
	for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) cin >> c[i][j];
	for (int i = 1; i <= n; i++) {
		for (int j = m; j >= 1; j--) {
			psx[i][j] = psx[i][j+1];
			if (c[i][j] == 'O') psx[i][j]++;
		}
	}
	for (int j = 1; j <= m; j++) {
		for (int i = n; i >= 1; i--) {
			psy[i][j] = psy[i+1][j];
			if (c[i][j] == 'I') psy[i][j]++;
		}
	}
	for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) if (c[i][j] == 'J') ans += psx[i][j]*psy[i][j];
	cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 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 308 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 2 ms 1364 KB Output is correct
8 Correct 1 ms 1464 KB Output is correct
9 Correct 2 ms 1492 KB Output is correct
10 Correct 1 ms 1468 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 2 ms 1472 KB Output is correct
13 Correct 2 ms 1340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 308 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 2 ms 1364 KB Output is correct
8 Correct 1 ms 1464 KB Output is correct
9 Correct 2 ms 1492 KB Output is correct
10 Correct 1 ms 1468 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 2 ms 1472 KB Output is correct
13 Correct 2 ms 1340 KB Output is correct
14 Correct 18 ms 8892 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 11 ms 5312 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 21 ms 9940 KB Output is correct
19 Correct 19 ms 9792 KB Output is correct
20 Correct 19 ms 9676 KB Output is correct
21 Correct 21 ms 9932 KB Output is correct
22 Correct 18 ms 9812 KB Output is correct
23 Correct 19 ms 9684 KB Output is correct
24 Correct 20 ms 9932 KB Output is correct
25 Correct 19 ms 9704 KB Output is correct
26 Correct 23 ms 9676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 308 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 2 ms 1364 KB Output is correct
8 Correct 1 ms 1464 KB Output is correct
9 Correct 2 ms 1492 KB Output is correct
10 Correct 1 ms 1468 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 2 ms 1472 KB Output is correct
13 Correct 2 ms 1340 KB Output is correct
14 Correct 18 ms 8892 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 11 ms 5312 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 21 ms 9940 KB Output is correct
19 Correct 19 ms 9792 KB Output is correct
20 Correct 19 ms 9676 KB Output is correct
21 Correct 21 ms 9932 KB Output is correct
22 Correct 18 ms 9812 KB Output is correct
23 Correct 19 ms 9684 KB Output is correct
24 Correct 20 ms 9932 KB Output is correct
25 Correct 19 ms 9704 KB Output is correct
26 Correct 23 ms 9676 KB Output is correct
27 Correct 685 ms 158816 KB Output is correct
28 Correct 14 ms 26324 KB Output is correct
29 Correct 44 ms 13900 KB Output is correct
30 Correct 2 ms 724 KB Output is correct
31 Correct 523 ms 131536 KB Output is correct
32 Correct 686 ms 159308 KB Output is correct
33 Correct 684 ms 158992 KB Output is correct
34 Correct 586 ms 152572 KB Output is correct
35 Correct 674 ms 159424 KB Output is correct
36 Correct 684 ms 158768 KB Output is correct
37 Correct 734 ms 159240 KB Output is correct
38 Correct 491 ms 130824 KB Output is correct
39 Correct 493 ms 131020 KB Output is correct