Submission #237797

# Submission time Handle Problem Language Result Execution time Memory
237797 2020-06-08T19:15:14 Z dCoding Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
304 ms 86776 KB
#include <bits/stdc++.h>

#define ll long long int
#define pll pair<ll, ll>
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define F0R(i, n) for(auto i = 0; i < (n); i++)
#define FOR(i, a, b) for(auto i = (a); i <= (b); i++)
#define ROF(i, a, b) for(auto i = (a); i >= (b); i--)

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n, m; cin >> n >> m;
	string a[n]; F0R(i, n) cin >> a[i];
	int preo[n + 5][m + 5], prei[n + 5][m + 5];
	memset(preo, 0, sizeof(preo));
	memset(prei, 0, sizeof(prei));
	F0R(i, n) {
		ROF(j, m - 1, 0) {
			preo[i][j] = preo[i][j + 1] + (a[i][j] == 'O');
		}
	}
	F0R(j, m) {
		ROF(i, n - 1, 0) {
			prei[i][j] = prei[i + 1][j] + (a[i][j] == 'I');
		}
	}
	ll ans = 0;
	F0R(i, n) {
		F0R(j, m) {
			if(a[i][j] == 'J') {
				ans += prei[i][j] * preo[i][j];
			}
		}
	}
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 512 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 512 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 512 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 512 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 512 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 512 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 8 ms 2304 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 6 ms 1664 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 9 ms 2816 KB Output is correct
19 Correct 8 ms 2688 KB Output is correct
20 Correct 8 ms 2816 KB Output is correct
21 Correct 9 ms 2816 KB Output is correct
22 Correct 8 ms 2688 KB Output is correct
23 Correct 8 ms 2816 KB Output is correct
24 Correct 9 ms 2816 KB Output is correct
25 Correct 8 ms 2688 KB Output is correct
26 Correct 8 ms 2816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 512 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 512 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 512 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 8 ms 2304 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 6 ms 1664 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 9 ms 2816 KB Output is correct
19 Correct 8 ms 2688 KB Output is correct
20 Correct 8 ms 2816 KB Output is correct
21 Correct 9 ms 2816 KB Output is correct
22 Correct 8 ms 2688 KB Output is correct
23 Correct 8 ms 2816 KB Output is correct
24 Correct 9 ms 2816 KB Output is correct
25 Correct 8 ms 2688 KB Output is correct
26 Correct 8 ms 2816 KB Output is correct
27 Correct 288 ms 82296 KB Output is correct
28 Correct 5 ms 768 KB Output is correct
29 Correct 14 ms 6912 KB Output is correct
30 Correct 5 ms 640 KB Output is correct
31 Correct 208 ms 62220 KB Output is correct
32 Correct 280 ms 86264 KB Output is correct
33 Correct 286 ms 86604 KB Output is correct
34 Correct 240 ms 71160 KB Output is correct
35 Correct 275 ms 86392 KB Output is correct
36 Correct 268 ms 86648 KB Output is correct
37 Correct 304 ms 86776 KB Output is correct
38 Correct 177 ms 61688 KB Output is correct
39 Correct 179 ms 62076 KB Output is correct