Submission #204495

# Submission time Handle Problem Language Result Execution time Memory
204495 2020-02-26T05:30:14 Z T0p_ Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
257 ms 160520 KB
#include<bits/stdc++.h>
using namespace std;

char t[3030][3030];
long long dp[2][3030][3030];

int main()
{
	int n, m;
	scanf(" %d %d",&n,&m);
	for(int i=1 ; i<=n ; i++)
		scanf(" %s",t[i]+1);
	for(int i=n ; i>=1 ; i--)
	{
		for(int j=m ; j>=1 ; j--)
		{
			if(t[i][j] == 'O') dp[0][i][j]++;
			if(t[i][j] == 'I') dp[1][i][j]++;
			dp[0][i][j] += dp[0][i][j+1];
			dp[1][i][j] += dp[1][i+1][j];
		}
	}
	long long ans = 0;
	for(int i=1 ; i<=n ; i++)
		for(int j=1 ; j<=m ; j++)
			if(t[i][j] == 'J') ans += dp[0][i][j] * dp[1][i][j];
	printf("%lld\n",ans);
	return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf(" %d %d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf(" %s",t[i]+1);
   ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 5 ms 1656 KB Output is correct
6 Correct 6 ms 1528 KB Output is correct
7 Correct 5 ms 1400 KB Output is correct
8 Correct 6 ms 1528 KB Output is correct
9 Correct 5 ms 1528 KB Output is correct
10 Correct 6 ms 1400 KB Output is correct
11 Correct 6 ms 1528 KB Output is correct
12 Correct 6 ms 1528 KB Output is correct
13 Correct 6 ms 1400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 5 ms 1656 KB Output is correct
6 Correct 6 ms 1528 KB Output is correct
7 Correct 5 ms 1400 KB Output is correct
8 Correct 6 ms 1528 KB Output is correct
9 Correct 5 ms 1528 KB Output is correct
10 Correct 6 ms 1400 KB Output is correct
11 Correct 6 ms 1528 KB Output is correct
12 Correct 6 ms 1528 KB Output is correct
13 Correct 6 ms 1400 KB Output is correct
14 Correct 14 ms 9080 KB Output is correct
15 Correct 10 ms 5016 KB Output is correct
16 Correct 9 ms 5496 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 16 ms 9976 KB Output is correct
19 Correct 13 ms 9848 KB Output is correct
20 Correct 13 ms 9848 KB Output is correct
21 Correct 15 ms 9976 KB Output is correct
22 Correct 13 ms 9848 KB Output is correct
23 Correct 13 ms 9848 KB Output is correct
24 Correct 16 ms 9980 KB Output is correct
25 Correct 13 ms 9848 KB Output is correct
26 Correct 13 ms 9848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 5 ms 1656 KB Output is correct
6 Correct 6 ms 1528 KB Output is correct
7 Correct 5 ms 1400 KB Output is correct
8 Correct 6 ms 1528 KB Output is correct
9 Correct 5 ms 1528 KB Output is correct
10 Correct 6 ms 1400 KB Output is correct
11 Correct 6 ms 1528 KB Output is correct
12 Correct 6 ms 1528 KB Output is correct
13 Correct 6 ms 1400 KB Output is correct
14 Correct 14 ms 9080 KB Output is correct
15 Correct 10 ms 5016 KB Output is correct
16 Correct 9 ms 5496 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 16 ms 9976 KB Output is correct
19 Correct 13 ms 9848 KB Output is correct
20 Correct 13 ms 9848 KB Output is correct
21 Correct 15 ms 9976 KB Output is correct
22 Correct 13 ms 9848 KB Output is correct
23 Correct 13 ms 9848 KB Output is correct
24 Correct 16 ms 9980 KB Output is correct
25 Correct 13 ms 9848 KB Output is correct
26 Correct 13 ms 9848 KB Output is correct
27 Correct 250 ms 159864 KB Output is correct
28 Correct 21 ms 26360 KB Output is correct
29 Correct 19 ms 13944 KB Output is correct
30 Correct 6 ms 760 KB Output is correct
31 Correct 188 ms 131832 KB Output is correct
32 Correct 180 ms 160248 KB Output is correct
33 Correct 174 ms 159864 KB Output is correct
34 Correct 218 ms 152696 KB Output is correct
35 Correct 180 ms 160248 KB Output is correct
36 Correct 172 ms 159864 KB Output is correct
37 Correct 257 ms 160520 KB Output is correct
38 Correct 138 ms 130936 KB Output is correct
39 Correct 134 ms 131192 KB Output is correct