Submission #531983

# Submission time Handle Problem Language Result Execution time Memory
531983 2022-03-02T02:53:36 Z rk42745417 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
143 ms 45704 KB
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(0);
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using ld = long double;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const ll LINF = ll(4e15) + ll(2e15);
const double EPS = 1e-9;
static int LamyIsCute = []() {
	EmiliaMyWife
	return 48763;
}();

signed main() {
	int n, m;
	cin >> n >> m;
	vector<string> arr(n);
	vector<vector<int>> cnt(n, vector<int>(m));
	ll ans = 0;
	for(auto &s : arr)
		cin >> s;
	for(int i = n - 1; ~i; i--) {
		for(int j = 0; j < m; j++) {
			if(i + 1 < n)
				cnt[i][j] = cnt[i + 1][j];
			if(arr[i][j] == 'I')
				cnt[i][j]++;
		}
	}
	for(int i = 0; i < n; i++) {
		for(int j = m - 1, res = 0; ~j; j--) {
			if(arr[i][j] == 'O')
				res++;
			if(arr[i][j] == 'J')
				ans += res * cnt[i][j];
		}
	}
	cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 5 ms 1296 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 2 ms 972 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 5 ms 1484 KB Output is correct
19 Correct 3 ms 1536 KB Output is correct
20 Correct 2 ms 1484 KB Output is correct
21 Correct 5 ms 1484 KB Output is correct
22 Correct 3 ms 1484 KB Output is correct
23 Correct 2 ms 1484 KB Output is correct
24 Correct 4 ms 1484 KB Output is correct
25 Correct 2 ms 1484 KB Output is correct
26 Correct 2 ms 1484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 5 ms 1296 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 2 ms 972 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 5 ms 1484 KB Output is correct
19 Correct 3 ms 1536 KB Output is correct
20 Correct 2 ms 1484 KB Output is correct
21 Correct 5 ms 1484 KB Output is correct
22 Correct 3 ms 1484 KB Output is correct
23 Correct 2 ms 1484 KB Output is correct
24 Correct 4 ms 1484 KB Output is correct
25 Correct 2 ms 1484 KB Output is correct
26 Correct 2 ms 1484 KB Output is correct
27 Correct 135 ms 42884 KB Output is correct
28 Correct 1 ms 572 KB Output is correct
29 Correct 6 ms 3568 KB Output is correct
30 Correct 1 ms 332 KB Output is correct
31 Correct 110 ms 31564 KB Output is correct
32 Correct 88 ms 44996 KB Output is correct
33 Correct 62 ms 45260 KB Output is correct
34 Correct 112 ms 36476 KB Output is correct
35 Correct 75 ms 45240 KB Output is correct
36 Correct 76 ms 45436 KB Output is correct
37 Correct 143 ms 45704 KB Output is correct
38 Correct 47 ms 31464 KB Output is correct
39 Correct 47 ms 31584 KB Output is correct