Submission #544900

# Submission time Handle Problem Language Result Execution time Memory
544900 2022-04-03T05:43:01 Z inluminas Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
158 ms 89356 KB
#include"bits/stdc++.h"
using namespace std;

#define ll long long
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false)
#define inf LLONG_MAX

int main(){
	fastio;

	int h,w;
	cin>>h>>w;
	string s[h+1];
	int o[h+1][w+1],I[h+1][w+1];
	for(int i=1;i<=h;i++){
		cin>>s[i];
	}
	for(int i=0;i<=h;i++){
		for(int j=0;j<=w;j++){
			o[i][j]=I[i][j]=0;
		}
	}
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			o[i][j]=o[i][j-1];
			I[i][j]=I[i-1][j];
			if(s[i][j-1]=='I') I[i][j]++;
			if(s[i][j-1]=='O') o[i][j]++;
		}
	}

	ll ans=0;

	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if(s[i][j-1]=='J'){
				ans+=(o[i][w]-o[i][j])*(I[h][j]-I[i][j]);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 4 ms 2132 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 2 ms 1492 KB Output is correct
17 Correct 1 ms 316 KB Output is correct
18 Correct 5 ms 2772 KB Output is correct
19 Correct 3 ms 2640 KB Output is correct
20 Correct 3 ms 2644 KB Output is correct
21 Correct 5 ms 2772 KB Output is correct
22 Correct 3 ms 2644 KB Output is correct
23 Correct 3 ms 2644 KB Output is correct
24 Correct 5 ms 2792 KB Output is correct
25 Correct 3 ms 2692 KB Output is correct
26 Correct 3 ms 2628 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 4 ms 2132 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 2 ms 1492 KB Output is correct
17 Correct 1 ms 316 KB Output is correct
18 Correct 5 ms 2772 KB Output is correct
19 Correct 3 ms 2640 KB Output is correct
20 Correct 3 ms 2644 KB Output is correct
21 Correct 5 ms 2772 KB Output is correct
22 Correct 3 ms 2644 KB Output is correct
23 Correct 3 ms 2644 KB Output is correct
24 Correct 5 ms 2792 KB Output is correct
25 Correct 3 ms 2692 KB Output is correct
26 Correct 3 ms 2628 KB Output is correct
27 Correct 157 ms 84388 KB Output is correct
28 Correct 1 ms 596 KB Output is correct
29 Correct 7 ms 6736 KB Output is correct
30 Correct 1 ms 468 KB Output is correct
31 Correct 106 ms 62112 KB Output is correct
32 Correct 86 ms 88760 KB Output is correct
33 Correct 88 ms 89036 KB Output is correct
34 Correct 128 ms 71876 KB Output is correct
35 Correct 88 ms 88780 KB Output is correct
36 Correct 87 ms 89132 KB Output is correct
37 Correct 158 ms 89356 KB Output is correct
38 Correct 60 ms 61560 KB Output is correct
39 Correct 58 ms 61848 KB Output is correct