Submission #582877

# Submission time Handle Problem Language Result Execution time Memory
582877 2022-06-24T14:24:26 Z 1ne Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
212 ms 89632 KB
#include<bits/stdc++.h>
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n,m;cin>>n>>m;
	vector<string>arr(n);
	for (int i = 0;i<n;++i)cin>>arr[i];
	long long ans = 0;
	vector<vector<int>>pref(n,vector<int>(m + 1,0));
	vector<vector<int>>pref2(m,vector<int>(n + 1,0));
	for (int i = 0;i<n;++i){
		for (int j = 0;j<m;++j){
			pref[i][j + 1] = pref[i][j] + (arr[i][j] == 'O');
		}
	}
	for (int i = 0;i<m;++i){
		for (int j = 0;j<n;++j){
			pref2[i][j + 1] = pref2[i][j] + (arr[j][i] == 'I');
		}
	}
	for (int i = 0;i<n;++i){
		for (int j = 0;j<m;++j){
			if (arr[i][j]!='J')continue;
			int l = pref[i][m] - pref[i][j];
			int k = pref2[j][n] - pref2[j][i];
			ans+=l * k;
		}
	}
	cout<<ans<<'\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 328 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 328 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 3 ms 2260 KB Output is correct
15 Correct 1 ms 320 KB Output is correct
16 Correct 2 ms 1596 KB Output is correct
17 Correct 1 ms 320 KB Output is correct
18 Correct 3 ms 2772 KB Output is correct
19 Correct 3 ms 2644 KB Output is correct
20 Correct 4 ms 2772 KB Output is correct
21 Correct 4 ms 2760 KB Output is correct
22 Correct 3 ms 2636 KB Output is correct
23 Correct 3 ms 2772 KB Output is correct
24 Correct 4 ms 2768 KB Output is correct
25 Correct 3 ms 2644 KB Output is correct
26 Correct 3 ms 2772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 328 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 3 ms 2260 KB Output is correct
15 Correct 1 ms 320 KB Output is correct
16 Correct 2 ms 1596 KB Output is correct
17 Correct 1 ms 320 KB Output is correct
18 Correct 3 ms 2772 KB Output is correct
19 Correct 3 ms 2644 KB Output is correct
20 Correct 4 ms 2772 KB Output is correct
21 Correct 4 ms 2760 KB Output is correct
22 Correct 3 ms 2636 KB Output is correct
23 Correct 3 ms 2772 KB Output is correct
24 Correct 4 ms 2768 KB Output is correct
25 Correct 3 ms 2644 KB Output is correct
26 Correct 3 ms 2772 KB Output is correct
27 Correct 196 ms 84588 KB Output is correct
28 Correct 1 ms 720 KB Output is correct
29 Correct 7 ms 6732 KB Output is correct
30 Correct 1 ms 596 KB Output is correct
31 Correct 114 ms 62388 KB Output is correct
32 Correct 154 ms 89076 KB Output is correct
33 Correct 189 ms 89336 KB Output is correct
34 Correct 140 ms 72072 KB Output is correct
35 Correct 212 ms 88908 KB Output is correct
36 Correct 188 ms 89224 KB Output is correct
37 Correct 196 ms 89632 KB Output is correct
38 Correct 92 ms 61796 KB Output is correct
39 Correct 139 ms 62036 KB Output is correct