Submission #818850

# Submission time Handle Problem Language Result Execution time Memory
818850 2023-08-10T07:01:26 Z vjudge1 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
275 ms 151532 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define endl "\n"
#define pii pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define pque priority_queue
#define pqueg priority_queue<ll,vector<ll>,greater<ll>>
#define que queue<ll>
#define FOR(m,i,n) for(int i=(m); i<=(n); i++)
#define FORM(m,i,n) for(int i=(m); i>=(n); i--)
#define all(v) sort(v.begin(),v.end())
ll h,w;
ll ans;
char grid[3030][3030];
ll prefi[3030][3030],prefo[3030][3030];
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> h >> w;
	FOR(1,i,h) {
		FOR(1,j,w) {
			cin >> grid[i][j];
			prefo[i][j] = prefo[i][j-1];
			prefi[i][j] = prefi[i-1][j];
			if(grid[i][j] == 'O') {
				prefo[i][j]++;
			}
			else if(grid[i][j] == 'I') {
				prefi[i][j]++;
			}
		}
	}
	FOR(1,i,h) {
		FOR(1,j,w) {
			if(grid[i][j] == 'J') {
				ans += (prefo[i][w] - prefo[i][j]) * (prefi[h][j] - prefi[i][j]);
			}
		}
	}
	cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 8 ms 8788 KB Output is correct
15 Correct 2 ms 5076 KB Output is correct
16 Correct 3 ms 5204 KB Output is correct
17 Correct 0 ms 468 KB Output is correct
18 Correct 10 ms 9716 KB Output is correct
19 Correct 7 ms 9524 KB Output is correct
20 Correct 7 ms 9556 KB Output is correct
21 Correct 10 ms 9748 KB Output is correct
22 Correct 7 ms 9556 KB Output is correct
23 Correct 6 ms 9532 KB Output is correct
24 Correct 10 ms 9684 KB Output is correct
25 Correct 7 ms 9556 KB Output is correct
26 Correct 9 ms 9588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 8 ms 8788 KB Output is correct
15 Correct 2 ms 5076 KB Output is correct
16 Correct 3 ms 5204 KB Output is correct
17 Correct 0 ms 468 KB Output is correct
18 Correct 10 ms 9716 KB Output is correct
19 Correct 7 ms 9524 KB Output is correct
20 Correct 7 ms 9556 KB Output is correct
21 Correct 10 ms 9748 KB Output is correct
22 Correct 7 ms 9556 KB Output is correct
23 Correct 6 ms 9532 KB Output is correct
24 Correct 10 ms 9684 KB Output is correct
25 Correct 7 ms 9556 KB Output is correct
26 Correct 9 ms 9588 KB Output is correct
27 Correct 245 ms 151436 KB Output is correct
28 Correct 13 ms 26324 KB Output is correct
29 Correct 12 ms 13268 KB Output is correct
30 Correct 1 ms 724 KB Output is correct
31 Correct 190 ms 125520 KB Output is correct
32 Correct 170 ms 151532 KB Output is correct
33 Correct 148 ms 150896 KB Output is correct
34 Correct 216 ms 145652 KB Output is correct
35 Correct 180 ms 151508 KB Output is correct
36 Correct 145 ms 151028 KB Output is correct
37 Correct 275 ms 151516 KB Output is correct
38 Correct 125 ms 124772 KB Output is correct
39 Correct 113 ms 125124 KB Output is correct