Submission #136792

# Submission time Handle Problem Language Result Execution time Memory
136792 2019-07-26T09:01:16 Z ekrem Bitaro the Brave (JOI19_ho_t1) C++
100 / 100
463 ms 79864 KB
#include <bits/stdc++.h>
 

#define mod 1000000007
#define mp make_pair
#define pb push_back
#define inside sl<=l&&r<=sr
#define outside sr<l||r<sl
using namespace std; 
typedef long long ll;
 
int n, m;
int dpo[3003][3003];
int dpi[3003][3003];
char mat[3003][3003];
 
int main(){
	//freopen("in", "r", stdin);
	//freopen("out", "w", stdout);
	cin.tie(0); ios::sync_with_stdio(false);
	
	cin >> n >> m;
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			cin >> mat[i][j];
		}
	}
 
	for (int i = 0; i < n; i++){
		int sum = 0;
		for (int j = m-1; j >= 0; j--){
			sum += mat[i][j] == 'O';
			dpo[i][j] = sum;
		}
	}
 
	for (int j = 0; j < m; j++){
		int sum = 0;
		for (int i = n-1; i >= 0; i--){
			sum += mat[i][j] == 'I';
			dpi[i][j] = sum;
		}
	}

	ll ans = 0;
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			if (mat[i][j] == 'J') ans += (ll)dpi[i][j]*(ll)dpo[i][j];
		}
	}
 
	cout << ans << endl;
 
}
//by ekrem
# 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 376 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 1400 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 1400 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 376 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 1400 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 1400 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 13 ms 7288 KB Output is correct
15 Correct 5 ms 4988 KB Output is correct
16 Correct 8 ms 4216 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 16 ms 7800 KB Output is correct
19 Correct 12 ms 7644 KB Output is correct
20 Correct 13 ms 7644 KB Output is correct
21 Correct 14 ms 7800 KB Output is correct
22 Correct 14 ms 7672 KB Output is correct
23 Correct 12 ms 7672 KB Output is correct
24 Correct 18 ms 7800 KB Output is correct
25 Correct 16 ms 7644 KB Output is correct
26 Correct 19 ms 7800 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 376 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 1400 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 1400 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 13 ms 7288 KB Output is correct
15 Correct 5 ms 4988 KB Output is correct
16 Correct 8 ms 4216 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 16 ms 7800 KB Output is correct
19 Correct 12 ms 7644 KB Output is correct
20 Correct 13 ms 7644 KB Output is correct
21 Correct 14 ms 7800 KB Output is correct
22 Correct 14 ms 7672 KB Output is correct
23 Correct 12 ms 7672 KB Output is correct
24 Correct 18 ms 7800 KB Output is correct
25 Correct 16 ms 7644 KB Output is correct
26 Correct 19 ms 7800 KB Output is correct
27 Correct 457 ms 79848 KB Output is correct
28 Correct 22 ms 26076 KB Output is correct
29 Correct 20 ms 7160 KB Output is correct
30 Correct 3 ms 632 KB Output is correct
31 Correct 337 ms 66504 KB Output is correct
32 Correct 432 ms 79840 KB Output is correct
33 Correct 418 ms 79624 KB Output is correct
34 Correct 377 ms 77040 KB Output is correct
35 Correct 463 ms 79864 KB Output is correct
36 Correct 414 ms 79580 KB Output is correct
37 Correct 462 ms 79800 KB Output is correct
38 Correct 309 ms 66516 KB Output is correct
39 Correct 292 ms 66168 KB Output is correct