Submission #347526

# Submission time Handle Problem Language Result Execution time Memory
347526 2021-01-13T07:33:44 Z jazzup Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
292 ms 53356 KB
#include<cstdio>

using namespace std;

char a[3001][3001];
int dp[3001][3001];

int main(){
	int h,w;
	scanf("%d%d",&h,&w);
	for(int i=0;i<h;i++){
		scanf("%s",a[i]);
	}

	int cnt;

	for(int i=h-1;i>=0;i--){
		cnt=0;
		for(int j=w-1;j>=0;j--){
			if(a[i][j]=='O')cnt++;
			else if(a[i][j]=='J')dp[i][j]=cnt;
			// printf("%d ",cnt);
		}
	}

	long long sum=0;

	for(int i=w-1;i>=0;i--){
		cnt=0;
		for(int j=h-1;j>=0;j--){
			if(a[j][i]=='I')cnt++;
			else if(a[j][i]=='J'){
				dp[j][i]*=cnt;
				sum+=dp[j][i];
			}
		}
	}

	printf("%lld\n",sum);
	// for(int i=0;i<h;i++){
	// 	for(int j=0;j<w;j++)
	// 		printf("%d ",dp[i][j]);
	// 	printf("\n");
	// }

	return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   11 |  scanf("%d%d",&h,&w);
      |  ~~~~~^~~~~~~~~~~~~~
joi2019_ho_t1.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   13 |   scanf("%s",a[i]);
      |   ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 1004 KB Output is correct
6 Correct 1 ms 1004 KB Output is correct
7 Correct 1 ms 1004 KB Output is correct
8 Correct 1 ms 1004 KB Output is correct
9 Correct 1 ms 1004 KB Output is correct
10 Correct 1 ms 1004 KB Output is correct
11 Correct 1 ms 1004 KB Output is correct
12 Correct 1 ms 1004 KB Output is correct
13 Correct 1 ms 1004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 1004 KB Output is correct
6 Correct 1 ms 1004 KB Output is correct
7 Correct 1 ms 1004 KB Output is correct
8 Correct 1 ms 1004 KB Output is correct
9 Correct 1 ms 1004 KB Output is correct
10 Correct 1 ms 1004 KB Output is correct
11 Correct 1 ms 1004 KB Output is correct
12 Correct 1 ms 1004 KB Output is correct
13 Correct 1 ms 1004 KB Output is correct
14 Correct 6 ms 4716 KB Output is correct
15 Correct 2 ms 3180 KB Output is correct
16 Correct 2 ms 2540 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 8 ms 4972 KB Output is correct
19 Correct 4 ms 4480 KB Output is correct
20 Correct 4 ms 4332 KB Output is correct
21 Correct 8 ms 4972 KB Output is correct
22 Correct 5 ms 4716 KB Output is correct
23 Correct 5 ms 4332 KB Output is correct
24 Correct 8 ms 4972 KB Output is correct
25 Correct 4 ms 4588 KB Output is correct
26 Correct 4 ms 4332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 1004 KB Output is correct
6 Correct 1 ms 1004 KB Output is correct
7 Correct 1 ms 1004 KB Output is correct
8 Correct 1 ms 1004 KB Output is correct
9 Correct 1 ms 1004 KB Output is correct
10 Correct 1 ms 1004 KB Output is correct
11 Correct 1 ms 1004 KB Output is correct
12 Correct 1 ms 1004 KB Output is correct
13 Correct 1 ms 1004 KB Output is correct
14 Correct 6 ms 4716 KB Output is correct
15 Correct 2 ms 3180 KB Output is correct
16 Correct 2 ms 2540 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 8 ms 4972 KB Output is correct
19 Correct 4 ms 4480 KB Output is correct
20 Correct 4 ms 4332 KB Output is correct
21 Correct 8 ms 4972 KB Output is correct
22 Correct 5 ms 4716 KB Output is correct
23 Correct 5 ms 4332 KB Output is correct
24 Correct 8 ms 4972 KB Output is correct
25 Correct 4 ms 4588 KB Output is correct
26 Correct 4 ms 4332 KB Output is correct
27 Correct 276 ms 52844 KB Output is correct
28 Correct 9 ms 15872 KB Output is correct
29 Correct 6 ms 3564 KB Output is correct
30 Correct 1 ms 492 KB Output is correct
31 Correct 203 ms 43116 KB Output is correct
32 Correct 155 ms 46060 KB Output is correct
33 Correct 171 ms 41580 KB Output is correct
34 Correct 234 ms 50028 KB Output is correct
35 Correct 187 ms 48108 KB Output is correct
36 Correct 170 ms 41580 KB Output is correct
37 Correct 292 ms 53356 KB Output is correct
38 Correct 110 ms 36076 KB Output is correct
39 Correct 120 ms 31868 KB Output is correct