Submission #879215

# Submission time Handle Problem Language Result Execution time Memory
879215 2023-11-26T23:09:29 Z mahmoudbadawy Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
166 ms 55888 KB
#include <bits/stdc++.h>

using namespace std;

const int N=3005;

int n,m;
string gr[N];
int co[N][N];

int main()
{
	cin >> n >> m;
	for(int i=0;i<n;i++) cin >> gr[i];
	for(int i=n-1;i>=0;i--)
	{
		for(int j=0;j<m;j++)
		{
			co[i][j]=(gr[i][j]=='I')+co[i+1][j];
		}
	}
	long long ans=0;
	for(int i=0;i<n;i++)
	{
		int cur=0;
		for(int j=m-1;j>=0;j--)
		{
			cur+=gr[i][j]=='O';
			if(gr[i][j]=='J')
			{
				ans+=1LL*cur*co[i][j];
			}
		}
	}
	printf("%lld\n", ans);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 860 KB Output is correct
6 Correct 1 ms 860 KB Output is correct
7 Correct 1 ms 860 KB Output is correct
8 Correct 1 ms 800 KB Output is correct
9 Correct 1 ms 860 KB Output is correct
10 Correct 1 ms 860 KB Output is correct
11 Correct 1 ms 860 KB Output is correct
12 Correct 1 ms 860 KB Output is correct
13 Correct 1 ms 860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 860 KB Output is correct
6 Correct 1 ms 860 KB Output is correct
7 Correct 1 ms 860 KB Output is correct
8 Correct 1 ms 800 KB Output is correct
9 Correct 1 ms 860 KB Output is correct
10 Correct 1 ms 860 KB Output is correct
11 Correct 1 ms 860 KB Output is correct
12 Correct 1 ms 860 KB Output is correct
13 Correct 1 ms 860 KB Output is correct
14 Correct 6 ms 5720 KB Output is correct
15 Correct 1 ms 4700 KB Output is correct
16 Correct 3 ms 3232 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 6 ms 6236 KB Output is correct
19 Correct 5 ms 5980 KB Output is correct
20 Correct 5 ms 5980 KB Output is correct
21 Correct 6 ms 6236 KB Output is correct
22 Correct 5 ms 5980 KB Output is correct
23 Correct 5 ms 5980 KB Output is correct
24 Correct 6 ms 6232 KB Output is correct
25 Correct 5 ms 5980 KB Output is correct
26 Correct 5 ms 6116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 860 KB Output is correct
6 Correct 1 ms 860 KB Output is correct
7 Correct 1 ms 860 KB Output is correct
8 Correct 1 ms 800 KB Output is correct
9 Correct 1 ms 860 KB Output is correct
10 Correct 1 ms 860 KB Output is correct
11 Correct 1 ms 860 KB Output is correct
12 Correct 1 ms 860 KB Output is correct
13 Correct 1 ms 860 KB Output is correct
14 Correct 6 ms 5720 KB Output is correct
15 Correct 1 ms 4700 KB Output is correct
16 Correct 3 ms 3232 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 6 ms 6236 KB Output is correct
19 Correct 5 ms 5980 KB Output is correct
20 Correct 5 ms 5980 KB Output is correct
21 Correct 6 ms 6236 KB Output is correct
22 Correct 5 ms 5980 KB Output is correct
23 Correct 5 ms 5980 KB Output is correct
24 Correct 6 ms 6232 KB Output is correct
25 Correct 5 ms 5980 KB Output is correct
26 Correct 5 ms 6116 KB Output is correct
27 Correct 164 ms 55608 KB Output is correct
28 Correct 4 ms 27228 KB Output is correct
29 Correct 11 ms 4956 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 115 ms 45440 KB Output is correct
32 Correct 146 ms 55852 KB Output is correct
33 Correct 159 ms 55488 KB Output is correct
34 Correct 133 ms 52604 KB Output is correct
35 Correct 140 ms 55632 KB Output is correct
36 Correct 138 ms 55700 KB Output is correct
37 Correct 166 ms 55888 KB Output is correct
38 Correct 123 ms 45392 KB Output is correct
39 Correct 106 ms 45208 KB Output is correct