Submission #947616

# Submission time Handle Problem Language Result Execution time Memory
947616 2024-03-16T16:21:45 Z packmani Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
353 ms 161668 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int n,m;
string s[3005];
int suff_o[3005][3005];
int suff_i[3005][3005];
int sum;
int32_t main()
{
	cin >> n >> m;
	for(int i=0;i<n;i++)
		cin >> s[i];

	for(int i=0;i<n;i++)
	{
		for(int j=m-1;j>=0;j--)
		{
			suff_o[i][j]=suff_o[i][j+1];
			if(s[i][j]=='O') suff_o[i][j]++;
		}
	}
	for(int i=0;i<m;i++)
	{
		for(int j=n-1;j>=0;j--)
		{
			suff_i[j][i]=suff_i[j+1][i];
			if(s[j][i]=='I') suff_i[j][i]++;
		}
	}
	sum=0;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			if(s[i][j]=='J')
			{
				sum+=(suff_i[i][j])*(suff_o[i][j]);
			}
		}
	}
	cout << sum;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 1 ms 3164 KB Output is correct
6 Correct 1 ms 2908 KB Output is correct
7 Correct 1 ms 1372 KB Output is correct
8 Correct 1 ms 3416 KB Output is correct
9 Correct 1 ms 2904 KB Output is correct
10 Correct 1 ms 1312 KB Output is correct
11 Correct 1 ms 3164 KB Output is correct
12 Correct 1 ms 2908 KB Output is correct
13 Correct 1 ms 1372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 1 ms 3164 KB Output is correct
6 Correct 1 ms 2908 KB Output is correct
7 Correct 1 ms 1372 KB Output is correct
8 Correct 1 ms 3416 KB Output is correct
9 Correct 1 ms 2904 KB Output is correct
10 Correct 1 ms 1312 KB Output is correct
11 Correct 1 ms 3164 KB Output is correct
12 Correct 1 ms 2908 KB Output is correct
13 Correct 1 ms 1372 KB Output is correct
14 Correct 8 ms 15148 KB Output is correct
15 Correct 2 ms 10588 KB Output is correct
16 Correct 6 ms 7516 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 10 ms 15964 KB Output is correct
19 Correct 8 ms 15452 KB Output is correct
20 Correct 8 ms 15656 KB Output is correct
21 Correct 10 ms 15960 KB Output is correct
22 Correct 9 ms 15452 KB Output is correct
23 Correct 10 ms 15832 KB Output is correct
24 Correct 10 ms 16008 KB Output is correct
25 Correct 8 ms 15452 KB Output is correct
26 Correct 9 ms 15736 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 1 ms 3164 KB Output is correct
6 Correct 1 ms 2908 KB Output is correct
7 Correct 1 ms 1372 KB Output is correct
8 Correct 1 ms 3416 KB Output is correct
9 Correct 1 ms 2904 KB Output is correct
10 Correct 1 ms 1312 KB Output is correct
11 Correct 1 ms 3164 KB Output is correct
12 Correct 1 ms 2908 KB Output is correct
13 Correct 1 ms 1372 KB Output is correct
14 Correct 8 ms 15148 KB Output is correct
15 Correct 2 ms 10588 KB Output is correct
16 Correct 6 ms 7516 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 10 ms 15964 KB Output is correct
19 Correct 8 ms 15452 KB Output is correct
20 Correct 8 ms 15656 KB Output is correct
21 Correct 10 ms 15960 KB Output is correct
22 Correct 9 ms 15452 KB Output is correct
23 Correct 10 ms 15832 KB Output is correct
24 Correct 10 ms 16008 KB Output is correct
25 Correct 8 ms 15452 KB Output is correct
26 Correct 9 ms 15736 KB Output is correct
27 Correct 306 ms 161108 KB Output is correct
28 Correct 11 ms 63632 KB Output is correct
29 Correct 16 ms 14340 KB Output is correct
30 Correct 1 ms 860 KB Output is correct
31 Correct 262 ms 133516 KB Output is correct
32 Correct 269 ms 161596 KB Output is correct
33 Correct 284 ms 161136 KB Output is correct
34 Correct 285 ms 154732 KB Output is correct
35 Correct 327 ms 161668 KB Output is correct
36 Correct 314 ms 161320 KB Output is correct
37 Correct 353 ms 161620 KB Output is correct
38 Correct 221 ms 133252 KB Output is correct
39 Correct 232 ms 132948 KB Output is correct