Submission #209198

# Submission time Handle Problem Language Result Execution time Memory
209198 2020-03-13T11:14:59 Z kostia244 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
240 ms 80504 KB
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
using namespace std;
using ll = long long;
using vi = vector<ll>;
const int maxn= 3030;
int n, m;
char mat[maxn][maxn];
int J[maxn][maxn], I[maxn][maxn];
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> m;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
			cin >> mat[i][j];
	for(int i = 1; i <= n; i++) {
		for(int j = m; j; j--) {
			J[i][j] = J[i][j+1] + (mat[i][j] == 'O');
		}
	}
	for(int i = n; i; i--) {
		for(int j = 1; j <= m; j++) {
			I[i][j] = I[i+1][j] + (mat[i][j] == 'I');
		}
	}
	ll ans = 0;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++) {
			if(mat[i][j] != 'J') continue;
			ans += J[i][j] * I[i][j];
		}
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 6 ms 504 KB Output is correct
5 Correct 5 ms 1528 KB Output is correct
6 Correct 5 ms 1528 KB Output is correct
7 Correct 5 ms 1400 KB Output is correct
8 Correct 5 ms 1528 KB Output is correct
9 Correct 5 ms 1528 KB Output is correct
10 Correct 5 ms 1400 KB Output is correct
11 Correct 6 ms 1532 KB Output is correct
12 Correct 5 ms 1528 KB Output is correct
13 Correct 5 ms 1400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 6 ms 504 KB Output is correct
5 Correct 5 ms 1528 KB Output is correct
6 Correct 5 ms 1528 KB Output is correct
7 Correct 5 ms 1400 KB Output is correct
8 Correct 5 ms 1528 KB Output is correct
9 Correct 5 ms 1528 KB Output is correct
10 Correct 5 ms 1400 KB Output is correct
11 Correct 6 ms 1532 KB Output is correct
12 Correct 5 ms 1528 KB Output is correct
13 Correct 5 ms 1400 KB Output is correct
14 Correct 12 ms 7288 KB Output is correct
15 Correct 8 ms 4984 KB Output is correct
16 Correct 9 ms 4216 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 14 ms 7800 KB Output is correct
19 Correct 13 ms 7672 KB Output is correct
20 Correct 13 ms 7672 KB Output is correct
21 Correct 15 ms 7800 KB Output is correct
22 Correct 13 ms 7672 KB Output is correct
23 Correct 13 ms 7672 KB Output is correct
24 Correct 14 ms 7800 KB Output is correct
25 Correct 13 ms 7672 KB Output is correct
26 Correct 13 ms 7676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 6 ms 504 KB Output is correct
5 Correct 5 ms 1528 KB Output is correct
6 Correct 5 ms 1528 KB Output is correct
7 Correct 5 ms 1400 KB Output is correct
8 Correct 5 ms 1528 KB Output is correct
9 Correct 5 ms 1528 KB Output is correct
10 Correct 5 ms 1400 KB Output is correct
11 Correct 6 ms 1532 KB Output is correct
12 Correct 5 ms 1528 KB Output is correct
13 Correct 5 ms 1400 KB Output is correct
14 Correct 12 ms 7288 KB Output is correct
15 Correct 8 ms 4984 KB Output is correct
16 Correct 9 ms 4216 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 14 ms 7800 KB Output is correct
19 Correct 13 ms 7672 KB Output is correct
20 Correct 13 ms 7672 KB Output is correct
21 Correct 15 ms 7800 KB Output is correct
22 Correct 13 ms 7672 KB Output is correct
23 Correct 13 ms 7672 KB Output is correct
24 Correct 14 ms 7800 KB Output is correct
25 Correct 13 ms 7672 KB Output is correct
26 Correct 13 ms 7676 KB Output is correct
27 Correct 231 ms 80452 KB Output is correct
28 Correct 19 ms 26104 KB Output is correct
29 Correct 20 ms 7288 KB Output is correct
30 Correct 5 ms 632 KB Output is correct
31 Correct 170 ms 67064 KB Output is correct
32 Correct 206 ms 80504 KB Output is correct
33 Correct 205 ms 80124 KB Output is correct
34 Correct 200 ms 77692 KB Output is correct
35 Correct 214 ms 80376 KB Output is correct
36 Correct 212 ms 80084 KB Output is correct
37 Correct 240 ms 80376 KB Output is correct
38 Correct 153 ms 67064 KB Output is correct
39 Correct 163 ms 66808 KB Output is correct