Submission #1003044

# Submission time Handle Problem Language Result Execution time Memory
1003044 2024-06-20T03:50:56 Z tamir1 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
340 ms 88572 KB
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int x,y,n,m,i,j,dp1[3005][3005],dp2[3005][3005];
ll ans;
char s[3005][3005];
int main(){
	cin >> n >> m;
	for(i=1;i<=n;i++){
		for(j=1;j<=m;j++){
			cin >> s[i][j];
		}
	}
	for(i=n;i>0;i--){
		for(j=m;j>0;j--){
			dp1[i][j]=dp1[i][j+1];
			dp2[i][j]=dp2[i+1][j];
			if(s[i][j]=='J') ans+=dp1[i][j]*dp2[i][j];
			if(s[i][j]=='O') dp1[i][j]++;
			if(s[i][j]=='I') dp2[i][j]++;
		}
	}
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 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 1628 KB Output is correct
6 Correct 1 ms 1628 KB Output is correct
7 Correct 1 ms 1372 KB Output is correct
8 Correct 1 ms 1628 KB Output is correct
9 Correct 1 ms 1628 KB Output is correct
10 Correct 1 ms 1432 KB Output is correct
11 Correct 1 ms 1480 KB Output is correct
12 Correct 1 ms 1624 KB Output is correct
13 Correct 1 ms 1480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 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 1628 KB Output is correct
6 Correct 1 ms 1628 KB Output is correct
7 Correct 1 ms 1372 KB Output is correct
8 Correct 1 ms 1628 KB Output is correct
9 Correct 1 ms 1628 KB Output is correct
10 Correct 1 ms 1432 KB Output is correct
11 Correct 1 ms 1480 KB Output is correct
12 Correct 1 ms 1624 KB Output is correct
13 Correct 1 ms 1480 KB Output is correct
14 Correct 9 ms 7516 KB Output is correct
15 Correct 2 ms 4956 KB Output is correct
16 Correct 5 ms 4444 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 12 ms 8028 KB Output is correct
19 Correct 9 ms 8024 KB Output is correct
20 Correct 9 ms 7772 KB Output is correct
21 Correct 12 ms 8024 KB Output is correct
22 Correct 9 ms 8028 KB Output is correct
23 Correct 10 ms 7772 KB Output is correct
24 Correct 10 ms 8028 KB Output is correct
25 Correct 10 ms 8024 KB Output is correct
26 Correct 9 ms 7956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 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 1628 KB Output is correct
6 Correct 1 ms 1628 KB Output is correct
7 Correct 1 ms 1372 KB Output is correct
8 Correct 1 ms 1628 KB Output is correct
9 Correct 1 ms 1628 KB Output is correct
10 Correct 1 ms 1432 KB Output is correct
11 Correct 1 ms 1480 KB Output is correct
12 Correct 1 ms 1624 KB Output is correct
13 Correct 1 ms 1480 KB Output is correct
14 Correct 9 ms 7516 KB Output is correct
15 Correct 2 ms 4956 KB Output is correct
16 Correct 5 ms 4444 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 12 ms 8028 KB Output is correct
19 Correct 9 ms 8024 KB Output is correct
20 Correct 9 ms 7772 KB Output is correct
21 Correct 12 ms 8024 KB Output is correct
22 Correct 9 ms 8028 KB Output is correct
23 Correct 10 ms 7772 KB Output is correct
24 Correct 10 ms 8028 KB Output is correct
25 Correct 10 ms 8024 KB Output is correct
26 Correct 9 ms 7956 KB Output is correct
27 Correct 289 ms 88112 KB Output is correct
28 Correct 9 ms 25948 KB Output is correct
29 Correct 21 ms 7780 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 220 ms 72556 KB Output is correct
32 Correct 306 ms 88540 KB Output is correct
33 Correct 278 ms 88252 KB Output is correct
34 Correct 261 ms 84212 KB Output is correct
35 Correct 280 ms 88400 KB Output is correct
36 Correct 269 ms 88152 KB Output is correct
37 Correct 340 ms 88572 KB Output is correct
38 Correct 200 ms 72516 KB Output is correct
39 Correct 189 ms 72272 KB Output is correct