Submission #245126

# Submission time Handle Problem Language Result Execution time Memory
245126 2020-07-05T14:27:45 Z groeneprof Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
133 ms 160120 KB
#include <bits/stdc++.h>
#define int long long
#define P(x) do {if(debug) cout << x << endl;} while(false)
#define H(x) P(#x << ": " << x)
#define FR(i, a, b) for(int i = (a); i < (b); ++i)
#define F(i, n) FR(i, 0, n)
#define DR(i, a, b) for(int i = (b); i --> (a);)
#define D(i, n) DR(i, 0, n)
#define S(s) (int)(s).size()
#define ALL(x) (x).begin(), (x).end()
#define MI(x, a) (x) = min(x, a)
#define MA(x, a) (x) = max(x, a)
#define V vector
#define pb push_back
#define mp make_pair
using namespace std;
const bool debug = 1;
const int inf = 1e18;
signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int h,w;
	cin>>h>>w;
	vector<string> grid(h);
	F(i,h){
		cin>>grid[i];
	}
	vector<vector<int> > O(h,vector<int> (w+1,0));
	vector<vector<int> > I(h+1, vector<int> (w,0));
	int ans = 0;
	for(int i = h-1; i>=0; i--){
		for(int j = w-1; j>=0; j--){
			O[i][j] = O[i][j+1] + (grid[i][j] == 'O');
			I[i][j] = I[i+1][j] + (grid[i][j] == 'I');
			ans+= (grid[i][j] == 'J') * O[i][j] * I[i][j];
		}
	}
	cout<<ans<<endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 512 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 5 ms 512 KB Output is correct
6 Correct 5 ms 512 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 5 ms 512 KB Output is correct
9 Correct 5 ms 512 KB Output is correct
10 Correct 5 ms 512 KB Output is correct
11 Correct 5 ms 512 KB Output is correct
12 Correct 5 ms 512 KB Output is correct
13 Correct 5 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 512 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 5 ms 512 KB Output is correct
6 Correct 5 ms 512 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 5 ms 512 KB Output is correct
9 Correct 5 ms 512 KB Output is correct
10 Correct 5 ms 512 KB Output is correct
11 Correct 5 ms 512 KB Output is correct
12 Correct 5 ms 512 KB Output is correct
13 Correct 5 ms 512 KB Output is correct
14 Correct 7 ms 3840 KB Output is correct
15 Correct 5 ms 512 KB Output is correct
16 Correct 7 ms 2688 KB Output is correct
17 Correct 4 ms 384 KB Output is correct
18 Correct 8 ms 4864 KB Output is correct
19 Correct 8 ms 4608 KB Output is correct
20 Correct 8 ms 4736 KB Output is correct
21 Correct 8 ms 4864 KB Output is correct
22 Correct 9 ms 4608 KB Output is correct
23 Correct 8 ms 4736 KB Output is correct
24 Correct 8 ms 4864 KB Output is correct
25 Correct 9 ms 4608 KB Output is correct
26 Correct 8 ms 4736 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 512 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 5 ms 512 KB Output is correct
6 Correct 5 ms 512 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 5 ms 512 KB Output is correct
9 Correct 5 ms 512 KB Output is correct
10 Correct 5 ms 512 KB Output is correct
11 Correct 5 ms 512 KB Output is correct
12 Correct 5 ms 512 KB Output is correct
13 Correct 5 ms 512 KB Output is correct
14 Correct 7 ms 3840 KB Output is correct
15 Correct 5 ms 512 KB Output is correct
16 Correct 7 ms 2688 KB Output is correct
17 Correct 4 ms 384 KB Output is correct
18 Correct 8 ms 4864 KB Output is correct
19 Correct 8 ms 4608 KB Output is correct
20 Correct 8 ms 4736 KB Output is correct
21 Correct 8 ms 4864 KB Output is correct
22 Correct 9 ms 4608 KB Output is correct
23 Correct 8 ms 4736 KB Output is correct
24 Correct 8 ms 4864 KB Output is correct
25 Correct 9 ms 4608 KB Output is correct
26 Correct 8 ms 4736 KB Output is correct
27 Correct 119 ms 151164 KB Output is correct
28 Correct 5 ms 1024 KB Output is correct
29 Correct 13 ms 11904 KB Output is correct
30 Correct 5 ms 768 KB Output is correct
31 Correct 88 ms 111224 KB Output is correct
32 Correct 122 ms 158968 KB Output is correct
33 Correct 133 ms 159608 KB Output is correct
34 Correct 99 ms 128888 KB Output is correct
35 Correct 121 ms 158968 KB Output is correct
36 Correct 123 ms 159608 KB Output is correct
37 Correct 123 ms 160120 KB Output is correct
38 Correct 87 ms 110328 KB Output is correct
39 Correct 85 ms 110816 KB Output is correct