Submission #208401

# Submission time Handle Problem Language Result Execution time Memory
208401 2020-03-11T07:20:39 Z cstuart Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
509 ms 150528 KB
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007ll
#define EPS 1e-9

typedef long long         ll;
typedef long double       ld;
typedef pair <ll,ll>      pl;
typedef tuple <ll,ll,ll>  tl;

ll H, W, OC[3005][3005], IC[3005][3005], T;
char PL[3005][3005];

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin >> H >> W;
	for (ll i = 1; i <= H; i++) {
		for (ll j = 1; j <= W; j++) {
			cin >> PL[i][j];
		}
	}
	
	for (ll i = 1; i <= H; i++) {
		OC[i][W+1] = 0;
		for (ll j = W; j >= 1; j--) {
			OC[i][j] = OC[i][j+1];
			if (PL[i][j] == 'O') OC[i][j]++;
		}
	}
	
	for (ll j = 1; j <= W; j++) {
		IC[H+1][j] = 0;
		for (ll i = H; i >= 1; i--) {
			IC[i][j] = IC[i+1][j];
			if (PL[i][j] == 'I') IC[i][j]++;
		}
	}
	
	T = 0;
	for (ll i = 1; i <= H; i++) {
		for (ll j = 1; j <= W; j++) {
			if (PL[i][j] == 'J') T += OC[i][j] * IC[i][j];
		}
	}
	
	cout << T;
		
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 5 ms 1656 KB Output is correct
6 Correct 5 ms 1528 KB Output is correct
7 Correct 5 ms 1528 KB Output is correct
8 Correct 5 ms 1528 KB Output is correct
9 Correct 6 ms 1528 KB Output is correct
10 Correct 5 ms 1528 KB Output is correct
11 Correct 6 ms 1656 KB Output is correct
12 Correct 5 ms 1528 KB Output is correct
13 Correct 5 ms 1528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 5 ms 1656 KB Output is correct
6 Correct 5 ms 1528 KB Output is correct
7 Correct 5 ms 1528 KB Output is correct
8 Correct 5 ms 1528 KB Output is correct
9 Correct 6 ms 1528 KB Output is correct
10 Correct 5 ms 1528 KB Output is correct
11 Correct 6 ms 1656 KB Output is correct
12 Correct 5 ms 1528 KB Output is correct
13 Correct 5 ms 1528 KB Output is correct
14 Correct 15 ms 8824 KB Output is correct
15 Correct 7 ms 5112 KB Output is correct
16 Correct 10 ms 5240 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 16 ms 9720 KB Output is correct
19 Correct 14 ms 9592 KB Output is correct
20 Correct 14 ms 9592 KB Output is correct
21 Correct 17 ms 9720 KB Output is correct
22 Correct 14 ms 9620 KB Output is correct
23 Correct 15 ms 9592 KB Output is correct
24 Correct 17 ms 9720 KB Output is correct
25 Correct 15 ms 9700 KB Output is correct
26 Correct 14 ms 9592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 5 ms 1656 KB Output is correct
6 Correct 5 ms 1528 KB Output is correct
7 Correct 5 ms 1528 KB Output is correct
8 Correct 5 ms 1528 KB Output is correct
9 Correct 6 ms 1528 KB Output is correct
10 Correct 5 ms 1528 KB Output is correct
11 Correct 6 ms 1656 KB Output is correct
12 Correct 5 ms 1528 KB Output is correct
13 Correct 5 ms 1528 KB Output is correct
14 Correct 15 ms 8824 KB Output is correct
15 Correct 7 ms 5112 KB Output is correct
16 Correct 10 ms 5240 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 16 ms 9720 KB Output is correct
19 Correct 14 ms 9592 KB Output is correct
20 Correct 14 ms 9592 KB Output is correct
21 Correct 17 ms 9720 KB Output is correct
22 Correct 14 ms 9620 KB Output is correct
23 Correct 15 ms 9592 KB Output is correct
24 Correct 17 ms 9720 KB Output is correct
25 Correct 15 ms 9700 KB Output is correct
26 Correct 14 ms 9592 KB Output is correct
27 Correct 473 ms 150392 KB Output is correct
28 Correct 18 ms 26392 KB Output is correct
29 Correct 27 ms 13304 KB Output is correct
30 Correct 6 ms 888 KB Output is correct
31 Correct 351 ms 125432 KB Output is correct
32 Correct 430 ms 150524 KB Output is correct
33 Correct 446 ms 149880 KB Output is correct
34 Correct 404 ms 145376 KB Output is correct
35 Correct 454 ms 150520 KB Output is correct
36 Correct 432 ms 149832 KB Output is correct
37 Correct 509 ms 150528 KB Output is correct
38 Correct 317 ms 124792 KB Output is correct
39 Correct 322 ms 124920 KB Output is correct