Submission #939544

# Submission time Handle Problem Language Result Execution time Memory
939544 2024-03-06T13:39:48 Z Newtonabc Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
237 ms 91324 KB
#include<bits/stdc++.h>
using namespace std;
vector<string> tb;
const int N=3e3+10;
int o[N][N];
int e[N][N];
int main(){
	int h,w;
	cin>>h >>w;
	tb.resize(h+10);
	for(int i=0;i<h;i++){
		cin>>tb[i];
	}
	//cout<<1;
	for(int i=0;i<h;i++){
		for(int j=w-1;j>=0;j--){
			o[i][j]=o[i][j+1];
			if(tb[i][j]=='O') o[i][j]++;
		}
	}
	//cout<<2;
	for(int i=h-1;i>=0;i--){
		//cout<<4;
		for(int j=0;j<w;j++){
			//cout<<5;
			e[i][j]=e[i+1][j];
			if(tb[i][j]=='I') e[i][j]++;
		}
	}
	//cout<<3;
	long long sum=0;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(tb[i][j]=='J') sum+=(o[i][j+1]*e[i+1][j]);
		}
	}
	cout<<sum;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 1112 KB Output is correct
6 Correct 1 ms 1116 KB Output is correct
7 Correct 1 ms 1116 KB Output is correct
8 Correct 1 ms 1116 KB Output is correct
9 Correct 1 ms 1116 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1112 KB Output is correct
12 Correct 1 ms 1112 KB Output is correct
13 Correct 1 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 1112 KB Output is correct
6 Correct 1 ms 1116 KB Output is correct
7 Correct 1 ms 1116 KB Output is correct
8 Correct 1 ms 1116 KB Output is correct
9 Correct 1 ms 1116 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1112 KB Output is correct
12 Correct 1 ms 1112 KB Output is correct
13 Correct 1 ms 1116 KB Output is correct
14 Correct 7 ms 8284 KB Output is correct
15 Correct 2 ms 6488 KB Output is correct
16 Correct 4 ms 4700 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 9 ms 8792 KB Output is correct
19 Correct 7 ms 8540 KB Output is correct
20 Correct 7 ms 8796 KB Output is correct
21 Correct 9 ms 8948 KB Output is correct
22 Correct 7 ms 8792 KB Output is correct
23 Correct 8 ms 9052 KB Output is correct
24 Correct 10 ms 9048 KB Output is correct
25 Correct 7 ms 8796 KB Output is correct
26 Correct 7 ms 9052 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 1112 KB Output is correct
6 Correct 1 ms 1116 KB Output is correct
7 Correct 1 ms 1116 KB Output is correct
8 Correct 1 ms 1116 KB Output is correct
9 Correct 1 ms 1116 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1112 KB Output is correct
12 Correct 1 ms 1112 KB Output is correct
13 Correct 1 ms 1116 KB Output is correct
14 Correct 7 ms 8284 KB Output is correct
15 Correct 2 ms 6488 KB Output is correct
16 Correct 4 ms 4700 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 9 ms 8792 KB Output is correct
19 Correct 7 ms 8540 KB Output is correct
20 Correct 7 ms 8796 KB Output is correct
21 Correct 9 ms 8948 KB Output is correct
22 Correct 7 ms 8792 KB Output is correct
23 Correct 8 ms 9052 KB Output is correct
24 Correct 10 ms 9048 KB Output is correct
25 Correct 7 ms 8796 KB Output is correct
26 Correct 7 ms 9052 KB Output is correct
27 Correct 234 ms 90652 KB Output is correct
28 Correct 8 ms 36700 KB Output is correct
29 Correct 14 ms 7980 KB Output is correct
30 Correct 1 ms 600 KB Output is correct
31 Correct 173 ms 74836 KB Output is correct
32 Correct 197 ms 91324 KB Output is correct
33 Correct 180 ms 90960 KB Output is correct
34 Correct 198 ms 86844 KB Output is correct
35 Correct 187 ms 91072 KB Output is correct
36 Correct 189 ms 90908 KB Output is correct
37 Correct 237 ms 91312 KB Output is correct
38 Correct 131 ms 74716 KB Output is correct
39 Correct 127 ms 74576 KB Output is correct