Submission #153353

# Submission time Handle Problem Language Result Execution time Memory
153353 2019-09-13T15:26:12 Z junodeveloper Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
311 ms 53368 KB
#include <bits/stdc++.h>
#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int h,w;
int tmp[3010][3010];
char s[3010][3010];
int main() {
	scanf("%d%d",&h,&w);
	int i,j;
	for(i=0;i<h;i++) scanf("%s",s[i]);
	for(i=0;i<h;i++) {
		int c=0;
		for(j=w-1;j>=0;j--) {
			if(s[i][j]=='O') c++;
			else if(s[i][j]=='J') tmp[i][j]=c;
		}
	}
	ll ans=0;
	for(j=0;j<w;j++) {
		int c=0;
		for(i=h-1;i>=0;i--) {
			if(s[i][j]=='I') c++;
			else if(s[i][j]=='J') ans+=tmp[i][j]*c;
		}
	}
	printf("%lld",ans);
	return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&h,&w);
  ~~~~~^~~~~~~~~~~~~~
joi2019_ho_t1.cpp:17:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(i=0;i<h;i++) scanf("%s",s[i]);
                   ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 1016 KB Output is correct
6 Correct 3 ms 1016 KB Output is correct
7 Correct 3 ms 884 KB Output is correct
8 Correct 3 ms 1016 KB Output is correct
9 Correct 3 ms 1016 KB Output is correct
10 Correct 3 ms 888 KB Output is correct
11 Correct 3 ms 1016 KB Output is correct
12 Correct 5 ms 1016 KB Output is correct
13 Correct 3 ms 888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 1016 KB Output is correct
6 Correct 3 ms 1016 KB Output is correct
7 Correct 3 ms 884 KB Output is correct
8 Correct 3 ms 1016 KB Output is correct
9 Correct 3 ms 1016 KB Output is correct
10 Correct 3 ms 888 KB Output is correct
11 Correct 3 ms 1016 KB Output is correct
12 Correct 5 ms 1016 KB Output is correct
13 Correct 3 ms 888 KB Output is correct
14 Correct 9 ms 4728 KB Output is correct
15 Correct 4 ms 3192 KB Output is correct
16 Correct 5 ms 2552 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 11 ms 4984 KB Output is correct
19 Correct 7 ms 4600 KB Output is correct
20 Correct 7 ms 4216 KB Output is correct
21 Correct 11 ms 5116 KB Output is correct
22 Correct 9 ms 4732 KB Output is correct
23 Correct 7 ms 4344 KB Output is correct
24 Correct 11 ms 5112 KB Output is correct
25 Correct 8 ms 4600 KB Output is correct
26 Correct 7 ms 4216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 1016 KB Output is correct
6 Correct 3 ms 1016 KB Output is correct
7 Correct 3 ms 884 KB Output is correct
8 Correct 3 ms 1016 KB Output is correct
9 Correct 3 ms 1016 KB Output is correct
10 Correct 3 ms 888 KB Output is correct
11 Correct 3 ms 1016 KB Output is correct
12 Correct 5 ms 1016 KB Output is correct
13 Correct 3 ms 888 KB Output is correct
14 Correct 9 ms 4728 KB Output is correct
15 Correct 4 ms 3192 KB Output is correct
16 Correct 5 ms 2552 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 11 ms 4984 KB Output is correct
19 Correct 7 ms 4600 KB Output is correct
20 Correct 7 ms 4216 KB Output is correct
21 Correct 11 ms 5116 KB Output is correct
22 Correct 9 ms 4732 KB Output is correct
23 Correct 7 ms 4344 KB Output is correct
24 Correct 11 ms 5112 KB Output is correct
25 Correct 8 ms 4600 KB Output is correct
26 Correct 7 ms 4216 KB Output is correct
27 Correct 305 ms 52748 KB Output is correct
28 Correct 15 ms 15992 KB Output is correct
29 Correct 8 ms 3576 KB Output is correct
30 Correct 3 ms 508 KB Output is correct
31 Correct 219 ms 43208 KB Output is correct
32 Correct 131 ms 46040 KB Output is correct
33 Correct 149 ms 41592 KB Output is correct
34 Correct 259 ms 50040 KB Output is correct
35 Correct 175 ms 47992 KB Output is correct
36 Correct 150 ms 41672 KB Output is correct
37 Correct 311 ms 53368 KB Output is correct
38 Correct 89 ms 36088 KB Output is correct
39 Correct 100 ms 31876 KB Output is correct