Submission #147408

# Submission time Handle Problem Language Result Execution time Memory
147408 2019-08-29T13:08:04 Z reda Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
329 ms 159376 KB
#include <bits/stdc++.h>

#define MAX 3010
#define ll long long
using namespace std;

int n, m;

ll ans;
ll PO[MAX][MAX];
ll PI[MAX][MAX];
char v[MAX][MAX];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	cin >> n >> m ;

	for(int g = 1 ; g <= n ; g++)
		for(int h = 1 ; h <= m ; h++)
			cin >> v[g][h];

	for(int g = 1 ; g <= n ; g++)
		for(int h = m ; h > 0 ; h--)
			PO[g][h] = PO[g][h + 1] + (v[g][h] == 'O') ;

	for(int g = n ; g > 0 ; g--)
		for(int h = 1 ; h <= m ; h++)
			PI[g][h] = PI[g + 1][h] + (v[g][h] == 'I') ;

	for(int g = 1 ; g <= n ; g++)
		for(int h = 1 ; h <= m ; h++)
			if(v[g][h] == 'J')
				ans += PO[g][h] * PI[g][h];

cout << ans ;
}
# Verdict Execution time Memory 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 2 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 1528 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 1528 KB Output is correct
11 Correct 3 ms 1528 KB Output is correct
12 Correct 3 ms 1528 KB Output is correct
13 Correct 3 ms 1400 KB Output is correct
# Verdict Execution time Memory 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 2 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 1528 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 1528 KB Output is correct
11 Correct 3 ms 1528 KB Output is correct
12 Correct 3 ms 1528 KB Output is correct
13 Correct 3 ms 1400 KB Output is correct
14 Correct 14 ms 8824 KB Output is correct
15 Correct 7 ms 5112 KB Output is correct
16 Correct 9 ms 5368 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 16 ms 9848 KB Output is correct
19 Correct 15 ms 9592 KB Output is correct
20 Correct 15 ms 9592 KB Output is correct
21 Correct 15 ms 9848 KB Output is correct
22 Correct 14 ms 9592 KB Output is correct
23 Correct 15 ms 9592 KB Output is correct
24 Correct 16 ms 9848 KB Output is correct
25 Correct 14 ms 9592 KB Output is correct
26 Correct 15 ms 9592 KB Output is correct
# Verdict Execution time Memory 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 2 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 1528 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 1528 KB Output is correct
11 Correct 3 ms 1528 KB Output is correct
12 Correct 3 ms 1528 KB Output is correct
13 Correct 3 ms 1400 KB Output is correct
14 Correct 14 ms 8824 KB Output is correct
15 Correct 7 ms 5112 KB Output is correct
16 Correct 9 ms 5368 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 16 ms 9848 KB Output is correct
19 Correct 15 ms 9592 KB Output is correct
20 Correct 15 ms 9592 KB Output is correct
21 Correct 15 ms 9848 KB Output is correct
22 Correct 14 ms 9592 KB Output is correct
23 Correct 15 ms 9592 KB Output is correct
24 Correct 16 ms 9848 KB Output is correct
25 Correct 14 ms 9592 KB Output is correct
26 Correct 15 ms 9592 KB Output is correct
27 Correct 314 ms 150724 KB Output is correct
28 Correct 26 ms 26360 KB Output is correct
29 Correct 28 ms 13308 KB Output is correct
30 Correct 3 ms 760 KB Output is correct
31 Correct 245 ms 125636 KB Output is correct
32 Correct 290 ms 150548 KB Output is correct
33 Correct 329 ms 158888 KB Output is correct
34 Correct 292 ms 152692 KB Output is correct
35 Correct 290 ms 159336 KB Output is correct
36 Correct 294 ms 158784 KB Output is correct
37 Correct 329 ms 159376 KB Output is correct
38 Correct 217 ms 130936 KB Output is correct
39 Correct 215 ms 131196 KB Output is correct