Submission #98203

# Submission time Handle Problem Language Result Execution time Memory
98203 2019-02-21T13:48:50 Z scanhex Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
192 ms 80648 KB
#include <bits/stdc++.h>

using namespace std;
using nagai = long long;
#define sz(x) int((x).size())

const int N=3003;
string ss[N];
int cri[N][N],cdo[N][N];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;++i)cin>>ss[i];
	for(int i=0;i<n;++i)
		for(int j=m-1;j>=0;j--)
			if(j==m-1)cri[i][j]=(ss[i][j]=='O');else cri[i][j]=(ss[i][j]=='O')+cri[i][j+1];
	nagai ans=0;
	for(int i=n-1;i>=0;--i)
		for(int j=0;j<m;++j){
			if(i==n-1)cdo[i][j]=(ss[i][j]=='I');else cdo[i][j]=(ss[i][j]=='I')+cdo[i+1][j];
			if(ss[i][j]=='J')
				ans+=cdo[i][j]*cri[i][j];
		}
	cout<<ans<<'\n';
	return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 2 ms 512 KB Output is correct
2 Correct 3 ms 512 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
4 Correct 3 ms 512 KB Output is correct
5 Correct 3 ms 1280 KB Output is correct
6 Correct 3 ms 1280 KB Output is correct
7 Correct 2 ms 1280 KB Output is correct
8 Correct 2 ms 1280 KB Output is correct
9 Correct 3 ms 1280 KB Output is correct
10 Correct 3 ms 1280 KB Output is correct
11 Correct 0 ms 1408 KB Output is correct
12 Correct 4 ms 1280 KB Output is correct
13 Correct 2 ms 1280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 512 KB Output is correct
2 Correct 3 ms 512 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
4 Correct 3 ms 512 KB Output is correct
5 Correct 3 ms 1280 KB Output is correct
6 Correct 3 ms 1280 KB Output is correct
7 Correct 2 ms 1280 KB Output is correct
8 Correct 2 ms 1280 KB Output is correct
9 Correct 3 ms 1280 KB Output is correct
10 Correct 3 ms 1280 KB Output is correct
11 Correct 0 ms 1408 KB Output is correct
12 Correct 4 ms 1280 KB Output is correct
13 Correct 2 ms 1280 KB Output is correct
14 Correct 9 ms 6144 KB Output is correct
15 Correct 5 ms 3840 KB Output is correct
16 Correct 7 ms 3584 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 11 ms 6656 KB Output is correct
19 Correct 8 ms 6528 KB Output is correct
20 Correct 9 ms 6524 KB Output is correct
21 Correct 11 ms 6656 KB Output is correct
22 Correct 9 ms 6528 KB Output is correct
23 Correct 10 ms 6656 KB Output is correct
24 Correct 10 ms 6656 KB Output is correct
25 Correct 2 ms 6552 KB Output is correct
26 Correct 9 ms 6548 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 512 KB Output is correct
2 Correct 3 ms 512 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
4 Correct 3 ms 512 KB Output is correct
5 Correct 3 ms 1280 KB Output is correct
6 Correct 3 ms 1280 KB Output is correct
7 Correct 2 ms 1280 KB Output is correct
8 Correct 2 ms 1280 KB Output is correct
9 Correct 3 ms 1280 KB Output is correct
10 Correct 3 ms 1280 KB Output is correct
11 Correct 0 ms 1408 KB Output is correct
12 Correct 4 ms 1280 KB Output is correct
13 Correct 2 ms 1280 KB Output is correct
14 Correct 9 ms 6144 KB Output is correct
15 Correct 5 ms 3840 KB Output is correct
16 Correct 7 ms 3584 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 11 ms 6656 KB Output is correct
19 Correct 8 ms 6528 KB Output is correct
20 Correct 9 ms 6524 KB Output is correct
21 Correct 11 ms 6656 KB Output is correct
22 Correct 9 ms 6528 KB Output is correct
23 Correct 10 ms 6656 KB Output is correct
24 Correct 10 ms 6656 KB Output is correct
25 Correct 2 ms 6552 KB Output is correct
26 Correct 9 ms 6548 KB Output is correct
27 Correct 136 ms 80092 KB Output is correct
28 Correct 18 ms 19252 KB Output is correct
29 Correct 11 ms 7168 KB Output is correct
30 Correct 2 ms 640 KB Output is correct
31 Correct 120 ms 65836 KB Output is correct
32 Correct 132 ms 80504 KB Output is correct
33 Correct 123 ms 80376 KB Output is correct
34 Correct 152 ms 76332 KB Output is correct
35 Correct 146 ms 80572 KB Output is correct
36 Correct 146 ms 80360 KB Output is correct
37 Correct 192 ms 80648 KB Output is correct
38 Correct 91 ms 65876 KB Output is correct
39 Correct 99 ms 65604 KB Output is correct