Submission #507615

# Submission time Handle Problem Language Result Execution time Memory
507615 2022-01-12T20:17:04 Z thomas_li Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
651 ms 88484 KB
#include <bits/stdc++.h>
using namespace std;
const int MM = 3e3+5;
int n,m,psar[MM][MM],psac[MM][MM]; char g[MM][MM];
int main(){
	cin >> n >> m;	
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= m; j++){
			cin >> g[i][j];
		}
	}
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= m; j++){
			psar[i][j] = psar[i][j-1] + (g[i][j] == 'O');
		}
	}
	for(int j = 1; j <= m; j++){
		for(int i = 1; i <= n; i++){
			psac[i][j] = psac[i-1][j] + (g[i][j] == 'I');
		}
	}
	int64_t ans = 0;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= m; j++){
			if(g[i][j] == 'J'){
				int cnt1 = psar[i][m] - psar[i][j];
				int cnt2 = psac[n][j] - psac[i][j];
				ans += 1ll*cnt1*cnt2;
			}
		}
	}
	cout << ans << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 304 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 1484 KB Output is correct
6 Correct 2 ms 1484 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1460 KB Output is correct
9 Correct 2 ms 1460 KB Output is correct
10 Correct 1 ms 1300 KB Output is correct
11 Correct 1 ms 1496 KB Output is correct
12 Correct 1 ms 1484 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 304 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 1484 KB Output is correct
6 Correct 2 ms 1484 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1460 KB Output is correct
9 Correct 2 ms 1460 KB Output is correct
10 Correct 1 ms 1300 KB Output is correct
11 Correct 1 ms 1496 KB Output is correct
12 Correct 1 ms 1484 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 15 ms 7500 KB Output is correct
15 Correct 3 ms 4940 KB Output is correct
16 Correct 9 ms 4264 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 19 ms 7868 KB Output is correct
19 Correct 20 ms 7844 KB Output is correct
20 Correct 18 ms 7756 KB Output is correct
21 Correct 20 ms 7936 KB Output is correct
22 Correct 17 ms 7860 KB Output is correct
23 Correct 17 ms 7732 KB Output is correct
24 Correct 20 ms 7988 KB Output is correct
25 Correct 19 ms 7896 KB Output is correct
26 Correct 18 ms 7756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 304 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 1484 KB Output is correct
6 Correct 2 ms 1484 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1460 KB Output is correct
9 Correct 2 ms 1460 KB Output is correct
10 Correct 1 ms 1300 KB Output is correct
11 Correct 1 ms 1496 KB Output is correct
12 Correct 1 ms 1484 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 15 ms 7500 KB Output is correct
15 Correct 3 ms 4940 KB Output is correct
16 Correct 9 ms 4264 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 19 ms 7868 KB Output is correct
19 Correct 20 ms 7844 KB Output is correct
20 Correct 18 ms 7756 KB Output is correct
21 Correct 20 ms 7936 KB Output is correct
22 Correct 17 ms 7860 KB Output is correct
23 Correct 17 ms 7732 KB Output is correct
24 Correct 20 ms 7988 KB Output is correct
25 Correct 19 ms 7896 KB Output is correct
26 Correct 18 ms 7756 KB Output is correct
27 Correct 626 ms 87900 KB Output is correct
28 Correct 13 ms 25932 KB Output is correct
29 Correct 40 ms 7680 KB Output is correct
30 Correct 2 ms 596 KB Output is correct
31 Correct 457 ms 72624 KB Output is correct
32 Correct 626 ms 88456 KB Output is correct
33 Correct 629 ms 88100 KB Output is correct
34 Correct 524 ms 83996 KB Output is correct
35 Correct 640 ms 88372 KB Output is correct
36 Correct 623 ms 88228 KB Output is correct
37 Correct 651 ms 88484 KB Output is correct
38 Correct 437 ms 72492 KB Output is correct
39 Correct 434 ms 72216 KB Output is correct