Submission #210027

# Submission time Handle Problem Language Result Execution time Memory
210027 2020-03-16T11:27:35 Z ld_minh4354 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
408 ms 160284 KB
#include<bits/stdc++.h>
using namespace std;

long long int m,n,i,j,dp1[3010][3010],dp2[3010][3010],ans;
string s[3010];

signed main()
{
    ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin>>m>>n;
	for (i=1;i<m+1;i++) cin>>s[i-1];
	for (i=1;i<m+1;i++)
	{
		dp1[i][n]=0;
		for (j=n-1;j>0;j--)
		if (s[i-1][j]=='O') dp1[i][j]=dp1[i][j+1]+1;
		else dp1[i][j]=dp1[i][j+1];
	}
	for (i=1;i<n+1;i++)
	{
		dp2[m][i]=0;
		for (j=m-1;j>0;j--)
		if (s[j][i-1]=='I') dp2[j][i]=dp2[j+1][i]+1;
		else dp2[j][i]=dp2[j+1][i];
	}
	ans=0;
	for (i=1;i<m+1;i++) for (j=1;j<n+1;j++) if (s[i-1][j-1]=='J')
	ans=ans+dp1[i][j]*dp2[i][j];
	cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 516 KB Output is correct
2 Correct 5 ms 424 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 6 ms 1400 KB Output is correct
6 Correct 5 ms 1404 KB Output is correct
7 Correct 5 ms 1272 KB Output is correct
8 Correct 6 ms 1400 KB Output is correct
9 Correct 5 ms 1400 KB Output is correct
10 Correct 5 ms 1272 KB Output is correct
11 Correct 5 ms 1400 KB Output is correct
12 Correct 5 ms 1400 KB Output is correct
13 Correct 5 ms 1400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 516 KB Output is correct
2 Correct 5 ms 424 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 6 ms 1400 KB Output is correct
6 Correct 5 ms 1404 KB Output is correct
7 Correct 5 ms 1272 KB Output is correct
8 Correct 6 ms 1400 KB Output is correct
9 Correct 5 ms 1400 KB Output is correct
10 Correct 5 ms 1272 KB Output is correct
11 Correct 5 ms 1400 KB Output is correct
12 Correct 5 ms 1400 KB Output is correct
13 Correct 5 ms 1400 KB Output is correct
14 Correct 12 ms 7804 KB Output is correct
15 Correct 6 ms 3960 KB Output is correct
16 Correct 8 ms 4856 KB Output is correct
17 Correct 5 ms 508 KB Output is correct
18 Correct 13 ms 8824 KB Output is correct
19 Correct 11 ms 8696 KB Output is correct
20 Correct 11 ms 8696 KB Output is correct
21 Correct 13 ms 8952 KB Output is correct
22 Correct 11 ms 8696 KB Output is correct
23 Correct 11 ms 8696 KB Output is correct
24 Correct 13 ms 8824 KB Output is correct
25 Correct 11 ms 8696 KB Output is correct
26 Correct 11 ms 8696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 516 KB Output is correct
2 Correct 5 ms 424 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 6 ms 1400 KB Output is correct
6 Correct 5 ms 1404 KB Output is correct
7 Correct 5 ms 1272 KB Output is correct
8 Correct 6 ms 1400 KB Output is correct
9 Correct 5 ms 1400 KB Output is correct
10 Correct 5 ms 1272 KB Output is correct
11 Correct 5 ms 1400 KB Output is correct
12 Correct 5 ms 1400 KB Output is correct
13 Correct 5 ms 1400 KB Output is correct
14 Correct 12 ms 7804 KB Output is correct
15 Correct 6 ms 3960 KB Output is correct
16 Correct 8 ms 4856 KB Output is correct
17 Correct 5 ms 508 KB Output is correct
18 Correct 13 ms 8824 KB Output is correct
19 Correct 11 ms 8696 KB Output is correct
20 Correct 11 ms 8696 KB Output is correct
21 Correct 13 ms 8952 KB Output is correct
22 Correct 11 ms 8696 KB Output is correct
23 Correct 11 ms 8696 KB Output is correct
24 Correct 13 ms 8824 KB Output is correct
25 Correct 11 ms 8696 KB Output is correct
26 Correct 11 ms 8696 KB Output is correct
27 Correct 372 ms 159224 KB Output is correct
28 Correct 15 ms 19580 KB Output is correct
29 Correct 17 ms 13944 KB Output is correct
30 Correct 5 ms 904 KB Output is correct
31 Correct 288 ms 130936 KB Output is correct
32 Correct 349 ms 160248 KB Output is correct
33 Correct 340 ms 159740 KB Output is correct
34 Correct 316 ms 151800 KB Output is correct
35 Correct 345 ms 160120 KB Output is correct
36 Correct 339 ms 159740 KB Output is correct
37 Correct 408 ms 160284 KB Output is correct
38 Correct 240 ms 130168 KB Output is correct
39 Correct 238 ms 130424 KB Output is correct