Submission #377891

# Submission time Handle Problem Language Result Execution time Memory
377891 2021-03-15T12:37:02 Z astoria Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
329 ms 150764 KB
#include "bits/stdc++.h"
using namespace std;

#define int long long

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	int h,w;
	cin>>h>>w;
	char g[h+5][w+5];
	for(int i=1; i<=h; i++){
		for(int j=1; j<=w; j++){
			cin>>g[i][j];
		}
	}
	
	int so[h+5][w+5], si[h+5][w+5];
	memset(so,0,sizeof(so)); memset(si,0,sizeof(si));
	//Orb: sec is higher; Ingot: fst is higher
	
	for(int i=1; i<=h; i++){
		for(int j=w; j>=1; j--){
			so[i][j] = so[i][j+1];
			if(g[i][j]=='O') so[i][j]++;
		}
	}
	
	for(int i=h; i>=1; i--){
		for(int j=1; j<=w; j++){
			si[i][j]=si[i+1][j];
			if(g[i][j]=='I') si[i][j]++;
		}
	}
	int an=0;
	for(int i=1; i<=h; i++){
		for(int j=1; j<=w; j++){
			if(g[i][j]=='J') an += (so[i][j]*si[i][j]);
		}
	}
	cout<<an;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 492 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 1 ms 492 KB Output is correct
8 Correct 1 ms 492 KB Output is correct
9 Correct 1 ms 492 KB Output is correct
10 Correct 1 ms 492 KB Output is correct
11 Correct 1 ms 492 KB Output is correct
12 Correct 1 ms 492 KB Output is correct
13 Correct 1 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 492 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 1 ms 492 KB Output is correct
8 Correct 1 ms 492 KB Output is correct
9 Correct 1 ms 492 KB Output is correct
10 Correct 1 ms 492 KB Output is correct
11 Correct 1 ms 492 KB Output is correct
12 Correct 1 ms 492 KB Output is correct
13 Correct 1 ms 492 KB Output is correct
14 Correct 8 ms 3564 KB Output is correct
15 Correct 1 ms 492 KB Output is correct
16 Correct 4 ms 2540 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 10 ms 4588 KB Output is correct
19 Correct 8 ms 4332 KB Output is correct
20 Correct 8 ms 4460 KB Output is correct
21 Correct 10 ms 4588 KB Output is correct
22 Correct 8 ms 4332 KB Output is correct
23 Correct 7 ms 4460 KB Output is correct
24 Correct 10 ms 4716 KB Output is correct
25 Correct 8 ms 4332 KB Output is correct
26 Correct 7 ms 4460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 492 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 1 ms 492 KB Output is correct
8 Correct 1 ms 492 KB Output is correct
9 Correct 1 ms 492 KB Output is correct
10 Correct 1 ms 492 KB Output is correct
11 Correct 1 ms 492 KB Output is correct
12 Correct 1 ms 492 KB Output is correct
13 Correct 1 ms 492 KB Output is correct
14 Correct 8 ms 3564 KB Output is correct
15 Correct 1 ms 492 KB Output is correct
16 Correct 4 ms 2540 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 10 ms 4588 KB Output is correct
19 Correct 8 ms 4332 KB Output is correct
20 Correct 8 ms 4460 KB Output is correct
21 Correct 10 ms 4588 KB Output is correct
22 Correct 8 ms 4332 KB Output is correct
23 Correct 7 ms 4460 KB Output is correct
24 Correct 10 ms 4716 KB Output is correct
25 Correct 8 ms 4332 KB Output is correct
26 Correct 7 ms 4460 KB Output is correct
27 Correct 307 ms 142316 KB Output is correct
28 Correct 1 ms 1004 KB Output is correct
29 Correct 19 ms 11500 KB Output is correct
30 Correct 2 ms 876 KB Output is correct
31 Correct 229 ms 104812 KB Output is correct
32 Correct 259 ms 149740 KB Output is correct
33 Correct 256 ms 150124 KB Output is correct
34 Correct 265 ms 121592 KB Output is correct
35 Correct 260 ms 149868 KB Output is correct
36 Correct 249 ms 150228 KB Output is correct
37 Correct 329 ms 150764 KB Output is correct
38 Correct 178 ms 104044 KB Output is correct
39 Correct 179 ms 104556 KB Output is correct