Submission #1062340

# Submission time Handle Problem Language Result Execution time Memory
1062340 2024-08-17T03:34:41 Z ducksaysquack Bitaro the Brave (JOI19_ho_t1) C++
100 / 100
307 ms 161768 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
	int n, k; cin >> n >> k; vector<string> v(n);
	for(int i=0;i<n;i++) cin >> v[i];
	vector<vector<int>> a(n, vector<int>(k)), b(n, vector<int>(k));
	for(int i=0;i<n;i++) for(int j=0;j<k;j++) {
		if(v[i][j] == 'O') a[i][j]++;
		if(j) a[i][j] += a[i][j-1];
	}
	for(int j=0;j<k;j++) for(int i=0;i<n;i++) {
		if(v[i][j] == 'I') b[i][j]++;
		if(i) b[i][j] += b[i-1][j];
	}
	int ans = 0;
	for(int i=0;i<n;i++) for(int j=0;j<k;j++) if(v[i][j] == 'J') ans += (b[n-1][j]-b[i][j])*(a[i][k-1]-a[i][j]);
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
14 Correct 7 ms 3676 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 3 ms 2732 KB Output is correct
17 Correct 0 ms 408 KB Output is correct
18 Correct 9 ms 4952 KB Output is correct
19 Correct 6 ms 4700 KB Output is correct
20 Correct 7 ms 4952 KB Output is correct
21 Correct 8 ms 4956 KB Output is correct
22 Correct 6 ms 4700 KB Output is correct
23 Correct 6 ms 4956 KB Output is correct
24 Correct 8 ms 5128 KB Output is correct
25 Correct 7 ms 4700 KB Output is correct
26 Correct 6 ms 4956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
14 Correct 7 ms 3676 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 3 ms 2732 KB Output is correct
17 Correct 0 ms 408 KB Output is correct
18 Correct 9 ms 4952 KB Output is correct
19 Correct 6 ms 4700 KB Output is correct
20 Correct 7 ms 4952 KB Output is correct
21 Correct 8 ms 4956 KB Output is correct
22 Correct 6 ms 4700 KB Output is correct
23 Correct 6 ms 4956 KB Output is correct
24 Correct 8 ms 5128 KB Output is correct
25 Correct 7 ms 4700 KB Output is correct
26 Correct 6 ms 4956 KB Output is correct
27 Correct 307 ms 153296 KB Output is correct
28 Correct 1 ms 860 KB Output is correct
29 Correct 18 ms 12096 KB Output is correct
30 Correct 1 ms 860 KB Output is correct
31 Correct 208 ms 114088 KB Output is correct
32 Correct 267 ms 160596 KB Output is correct
33 Correct 264 ms 161104 KB Output is correct
34 Correct 256 ms 132176 KB Output is correct
35 Correct 278 ms 160596 KB Output is correct
36 Correct 259 ms 161108 KB Output is correct
37 Correct 307 ms 161768 KB Output is correct
38 Correct 173 ms 113220 KB Output is correct
39 Correct 179 ms 113516 KB Output is correct