Submission #963334

# Submission time Handle Problem Language Result Execution time Memory
963334 2024-04-14T20:59:34 Z Saul0906 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
304 ms 159528 KB
#include <bits/stdc++.h>
#define rep(a,b,c) for(int a=b; a<c; a++)
#define ll long long

using namespace std;

int main(){
	ll h, w;
	cin>>h>>w;
	string g[h];
	ll ans=0, p[h][w], dp[h][w]{};
	rep(i,0,h){
		cin>>g[i];
		rep(j,0,w){
			p[i][j]=(g[i][j]=='O');
			if(j) p[i][j]+=p[i][j-1];
		}
	}
	rep(i,0,h){
		rep(j,0,w){
			if(i) dp[i][j]=dp[i-1][j];
			if(i && g[i-1][j]=='J') dp[i][j]+=p[i-1][w-1]-p[i-1][j];
			if(g[i][j]=='I') ans+=dp[i][j];
		}
	}
	cout<<ans<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 416 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 416 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 7 ms 3676 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 4 ms 2608 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 10 ms 4952 KB Output is correct
19 Correct 7 ms 4444 KB Output is correct
20 Correct 8 ms 4956 KB Output is correct
21 Correct 8 ms 4952 KB Output is correct
22 Correct 7 ms 4440 KB Output is correct
23 Correct 7 ms 4940 KB Output is correct
24 Correct 9 ms 4956 KB Output is correct
25 Correct 6 ms 4576 KB Output is correct
26 Correct 7 ms 4936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 416 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 7 ms 3676 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 4 ms 2608 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 10 ms 4952 KB Output is correct
19 Correct 7 ms 4444 KB Output is correct
20 Correct 8 ms 4956 KB Output is correct
21 Correct 8 ms 4952 KB Output is correct
22 Correct 7 ms 4440 KB Output is correct
23 Correct 7 ms 4940 KB Output is correct
24 Correct 9 ms 4956 KB Output is correct
25 Correct 6 ms 4576 KB Output is correct
26 Correct 7 ms 4936 KB Output is correct
27 Correct 304 ms 151532 KB Output is correct
28 Correct 2 ms 860 KB Output is correct
29 Correct 19 ms 12080 KB Output is correct
30 Correct 1 ms 856 KB Output is correct
31 Correct 204 ms 112488 KB Output is correct
32 Correct 231 ms 158672 KB Output is correct
33 Correct 230 ms 159104 KB Output is correct
34 Correct 255 ms 130580 KB Output is correct
35 Correct 244 ms 158704 KB Output is correct
36 Correct 224 ms 159060 KB Output is correct
37 Correct 296 ms 159528 KB Output is correct
38 Correct 159 ms 111680 KB Output is correct
39 Correct 171 ms 111984 KB Output is correct