Submission #497620

# Submission time Handle Problem Language Result Execution time Memory
497620 2021-12-23T11:53:33 Z penguin133 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
426 ms 88548 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long

int dp[1000005], P[3005], S[3005], L[3005][3005];
char g[3005][3005];
priority_queue<int>pq;
pair<int, int> A[1000005];
main(){
	ios::sync_with_stdio(0);cin.tie(0);
	int h,w,ans = 0;
	cin >> h >> w;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++)cin >> g[i][j];
	}
	for(int i=1;i<=h;i++){
		for(int j=w;j>=1;j--)L[i][j] = L[i][j+1] + (g[i][j] == 'O');
	}
	for(int i=1;i<=w;i++){
		for(int j=1;j<=h;j++)P[j] = P[j-1] + (g[j][i] == 'J');
		for(int j=h;j>=1;j--)S[j] = S[j+1] + (g[j][i] == 'I');
		for(int j=1;j<=h;j++)ans += (g[j][i] == 'J') * S[j+1] * L[j][i+1];
	}
	cout << ans;
	
}

Compilation message

joi2019_ho_t1.cpp:9:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    9 | main(){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 1112 KB Output is correct
6 Correct 1 ms 1100 KB Output is correct
7 Correct 2 ms 972 KB Output is correct
8 Correct 1 ms 1100 KB Output is correct
9 Correct 1 ms 1100 KB Output is correct
10 Correct 1 ms 972 KB Output is correct
11 Correct 1 ms 1108 KB Output is correct
12 Correct 1 ms 1100 KB Output is correct
13 Correct 1 ms 972 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 1112 KB Output is correct
6 Correct 1 ms 1100 KB Output is correct
7 Correct 2 ms 972 KB Output is correct
8 Correct 1 ms 1100 KB Output is correct
9 Correct 1 ms 1100 KB Output is correct
10 Correct 1 ms 972 KB Output is correct
11 Correct 1 ms 1108 KB Output is correct
12 Correct 1 ms 1100 KB Output is correct
13 Correct 1 ms 972 KB Output is correct
14 Correct 7 ms 5464 KB Output is correct
15 Correct 2 ms 3276 KB Output is correct
16 Correct 4 ms 3248 KB Output is correct
17 Correct 0 ms 332 KB Output is correct
18 Correct 11 ms 5992 KB Output is correct
19 Correct 9 ms 5836 KB Output is correct
20 Correct 10 ms 5852 KB Output is correct
21 Correct 9 ms 5964 KB Output is correct
22 Correct 9 ms 5848 KB Output is correct
23 Correct 10 ms 5828 KB Output is correct
24 Correct 9 ms 5924 KB Output is correct
25 Correct 9 ms 5960 KB Output is correct
26 Correct 8 ms 5836 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 1112 KB Output is correct
6 Correct 1 ms 1100 KB Output is correct
7 Correct 2 ms 972 KB Output is correct
8 Correct 1 ms 1100 KB Output is correct
9 Correct 1 ms 1100 KB Output is correct
10 Correct 1 ms 972 KB Output is correct
11 Correct 1 ms 1108 KB Output is correct
12 Correct 1 ms 1100 KB Output is correct
13 Correct 1 ms 972 KB Output is correct
14 Correct 7 ms 5464 KB Output is correct
15 Correct 2 ms 3276 KB Output is correct
16 Correct 4 ms 3248 KB Output is correct
17 Correct 0 ms 332 KB Output is correct
18 Correct 11 ms 5992 KB Output is correct
19 Correct 9 ms 5836 KB Output is correct
20 Correct 10 ms 5852 KB Output is correct
21 Correct 9 ms 5964 KB Output is correct
22 Correct 9 ms 5848 KB Output is correct
23 Correct 10 ms 5828 KB Output is correct
24 Correct 9 ms 5924 KB Output is correct
25 Correct 9 ms 5960 KB Output is correct
26 Correct 8 ms 5836 KB Output is correct
27 Correct 381 ms 88144 KB Output is correct
28 Correct 9 ms 16716 KB Output is correct
29 Correct 17 ms 7768 KB Output is correct
30 Correct 1 ms 588 KB Output is correct
31 Correct 264 ms 72536 KB Output is correct
32 Correct 389 ms 88388 KB Output is correct
33 Correct 389 ms 88256 KB Output is correct
34 Correct 321 ms 84264 KB Output is correct
35 Correct 403 ms 88380 KB Output is correct
36 Correct 398 ms 88376 KB Output is correct
37 Correct 426 ms 88548 KB Output is correct
38 Correct 270 ms 72360 KB Output is correct
39 Correct 271 ms 72304 KB Output is correct