Submission #503881

# Submission time Handle Problem Language Result Execution time Memory
503881 2022-01-09T06:17:52 Z bebecanvas Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
454 ms 158688 KB
#include <bits/stdc++.h>

using namespace std;
#define int long long
#define endl '\n'

signed main(){

	int h, w; cin >> h >> w;
	char g[h][w];
	for(int i=0; i<h; i++){
		string s; cin >> s;
		for(int j=0; j<w; j++){
			g[i][j]= s[j];
		}
	}
	
	int c1[h][w];
	for(int i=0; i<h; i++){
		int count= 0;
		for(int j=w-1; j>=0; j--){
			if(g[i][j]=='J'){c1[i][j]= count;}
			else{c1[i][j]= 0;}
			if(g[i][j]=='O'){count++;}
		}
	}
	
	int c2[h][w];
	for(int i=0; i<w; i++){
		int countt= 0;
		for(int j=h-1; j>=0; j--){
			if(g[j][i]=='J'){c2[j][i]= countt;}
			else{c2[j][i]= 0;}
			if(g[j][i]=='I'){countt++;}
		}
	}
	
	int ans= 0;
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			ans+= (c1[i][j]*c2[i][j]);
		}
	}
	
	cout << ans << endl;
}




# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 288 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 420 KB Output is correct
6 Correct 1 ms 352 KB Output is correct
7 Correct 1 ms 352 KB Output is correct
8 Correct 2 ms 428 KB Output is correct
9 Correct 1 ms 392 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 288 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 420 KB Output is correct
6 Correct 1 ms 352 KB Output is correct
7 Correct 1 ms 352 KB Output is correct
8 Correct 2 ms 428 KB Output is correct
9 Correct 1 ms 392 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 460 KB Output is correct
14 Correct 8 ms 3532 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 4 ms 2460 KB Output is correct
17 Correct 1 ms 284 KB Output is correct
18 Correct 11 ms 4740 KB Output is correct
19 Correct 10 ms 4464 KB Output is correct
20 Correct 8 ms 4504 KB Output is correct
21 Correct 10 ms 4620 KB Output is correct
22 Correct 10 ms 4488 KB Output is correct
23 Correct 9 ms 4508 KB Output is correct
24 Correct 11 ms 4612 KB Output is correct
25 Correct 9 ms 4448 KB Output is correct
26 Correct 9 ms 4556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 288 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 420 KB Output is correct
6 Correct 1 ms 352 KB Output is correct
7 Correct 1 ms 352 KB Output is correct
8 Correct 2 ms 428 KB Output is correct
9 Correct 1 ms 392 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 460 KB Output is correct
14 Correct 8 ms 3532 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 4 ms 2460 KB Output is correct
17 Correct 1 ms 284 KB Output is correct
18 Correct 11 ms 4740 KB Output is correct
19 Correct 10 ms 4464 KB Output is correct
20 Correct 8 ms 4504 KB Output is correct
21 Correct 10 ms 4620 KB Output is correct
22 Correct 10 ms 4488 KB Output is correct
23 Correct 9 ms 4508 KB Output is correct
24 Correct 11 ms 4612 KB Output is correct
25 Correct 9 ms 4448 KB Output is correct
26 Correct 9 ms 4556 KB Output is correct
27 Correct 454 ms 149852 KB Output is correct
28 Correct 2 ms 692 KB Output is correct
29 Correct 23 ms 11640 KB Output is correct
30 Correct 2 ms 588 KB Output is correct
31 Correct 318 ms 110340 KB Output is correct
32 Correct 437 ms 157608 KB Output is correct
33 Correct 432 ms 158348 KB Output is correct
34 Correct 350 ms 127952 KB Output is correct
35 Correct 406 ms 157732 KB Output is correct
36 Correct 418 ms 158240 KB Output is correct
37 Correct 448 ms 158688 KB Output is correct
38 Correct 312 ms 109488 KB Output is correct
39 Correct 255 ms 109900 KB Output is correct