Submission #308250

# Submission time Handle Problem Language Result Execution time Memory
308250 2020-09-30T13:27:47 Z Bill_00 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
572 ms 186652 KB
#include <bits/stdc++.h>
#define pp push
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
using namespace std;
char a[3005][3005];
ll dpi[3005][3005];
ll dpo[3005][3005];
vector<pair<int,int> >J;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int h,w;
	cin >> h >> w;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			cin >> a[i][j];
			if(a[i][j]=='J'){
				J.pb(mp(i,j));
			}
		}
	}
	for(int i=1;i<=w;i++){
		for(int j=h;j>=1;j--){
			if(a[j][i]=='I'){
				dpi[j][i]=dpi[j+1][i]+1;
			}
			else dpi[j][i]=dpi[j+1][i];
		}
	}
	for(int i=1;i<=h;i++){
		for(int j=w;j>=1;j--){
			if(a[i][j]=='O'){
				dpo[i][j]=dpo[i][j+1]+1;
			}
			else dpo[i][j]=dpo[i][j+1];
		}
	}
	ll ans=0;
	for(int i=0;i<J.size();i++){
		int x=J[i].ff;
		int y=J[i].ss;
		ans+=(dpo[x][y]*dpi[x][y]);
	}
	cout << ans;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:44:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |  for(int i=0;i<J.size();i++){
      |              ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 2 ms 1664 KB Output is correct
6 Correct 1 ms 1568 KB Output is correct
7 Correct 1 ms 1536 KB Output is correct
8 Correct 2 ms 1664 KB Output is correct
9 Correct 1 ms 1664 KB Output is correct
10 Correct 1 ms 1536 KB Output is correct
11 Correct 2 ms 1664 KB Output is correct
12 Correct 1 ms 1536 KB Output is correct
13 Correct 2 ms 1536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 2 ms 1664 KB Output is correct
6 Correct 1 ms 1568 KB Output is correct
7 Correct 1 ms 1536 KB Output is correct
8 Correct 2 ms 1664 KB Output is correct
9 Correct 1 ms 1664 KB Output is correct
10 Correct 1 ms 1536 KB Output is correct
11 Correct 2 ms 1664 KB Output is correct
12 Correct 1 ms 1536 KB Output is correct
13 Correct 2 ms 1536 KB Output is correct
14 Correct 12 ms 9468 KB Output is correct
15 Correct 4 ms 5120 KB Output is correct
16 Correct 7 ms 5756 KB Output is correct
17 Correct 1 ms 512 KB Output is correct
18 Correct 15 ms 10488 KB Output is correct
19 Correct 13 ms 9856 KB Output is correct
20 Correct 13 ms 10360 KB Output is correct
21 Correct 16 ms 10488 KB Output is correct
22 Correct 14 ms 10360 KB Output is correct
23 Correct 15 ms 10360 KB Output is correct
24 Correct 16 ms 10744 KB Output is correct
25 Correct 12 ms 9984 KB Output is correct
26 Correct 13 ms 10360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 2 ms 1664 KB Output is correct
6 Correct 1 ms 1568 KB Output is correct
7 Correct 1 ms 1536 KB Output is correct
8 Correct 2 ms 1664 KB Output is correct
9 Correct 1 ms 1664 KB Output is correct
10 Correct 1 ms 1536 KB Output is correct
11 Correct 2 ms 1664 KB Output is correct
12 Correct 1 ms 1536 KB Output is correct
13 Correct 2 ms 1536 KB Output is correct
14 Correct 12 ms 9468 KB Output is correct
15 Correct 4 ms 5120 KB Output is correct
16 Correct 7 ms 5756 KB Output is correct
17 Correct 1 ms 512 KB Output is correct
18 Correct 15 ms 10488 KB Output is correct
19 Correct 13 ms 9856 KB Output is correct
20 Correct 13 ms 10360 KB Output is correct
21 Correct 16 ms 10488 KB Output is correct
22 Correct 14 ms 10360 KB Output is correct
23 Correct 15 ms 10360 KB Output is correct
24 Correct 16 ms 10744 KB Output is correct
25 Correct 12 ms 9984 KB Output is correct
26 Correct 13 ms 10360 KB Output is correct
27 Correct 531 ms 172448 KB Output is correct
28 Correct 17 ms 26496 KB Output is correct
29 Correct 25 ms 15860 KB Output is correct
30 Correct 2 ms 1024 KB Output is correct
31 Correct 397 ms 147788 KB Output is correct
32 Correct 481 ms 165076 KB Output is correct
33 Correct 492 ms 181404 KB Output is correct
34 Correct 474 ms 170528 KB Output is correct
35 Correct 524 ms 181276 KB Output is correct
36 Correct 495 ms 181420 KB Output is correct
37 Correct 572 ms 186652 KB Output is correct
38 Correct 341 ms 136148 KB Output is correct
39 Correct 340 ms 147392 KB Output is correct