답안 #597199

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
597199 2022-07-15T17:19:24 Z Belphegor Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
215 ms 53152 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pi;
char arr[3005][3005];
short dp[3005][3005];
short DP[3005][3005];

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n,m; cin>>n>>m;
	for(int i=1; i<=n; i++) cin>>(arr[i]+1);
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++){
			if(arr[i][j]=='O') dp[i][j] = 1;
			if(arr[i][j]=='I') DP[i][j] = 1;
		}
		for(int j=m; j>=1; j--) dp[i][j]+=dp[i][j+1];
	}
	for(int i=1; i<=m; i++){
		for(int j=n; j>=1; j--) DP[j][i]+=DP[j+1][i];
	}
	ll ans = 0;
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++){
			if(arr[i][j]!='J') continue;
			ll w = dp[i][j];
			w*=DP[i][j];
			ans+=w;
		}
	}
	cout<<ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
5 Correct 2 ms 1364 KB Output is correct
6 Correct 1 ms 1356 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1364 KB Output is correct
9 Correct 1 ms 1352 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1364 KB Output is correct
12 Correct 1 ms 1364 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
5 Correct 2 ms 1364 KB Output is correct
6 Correct 1 ms 1356 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1364 KB Output is correct
9 Correct 1 ms 1352 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1364 KB Output is correct
12 Correct 1 ms 1364 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 6 ms 6740 KB Output is correct
15 Correct 2 ms 4944 KB Output is correct
16 Correct 3 ms 3796 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 7 ms 6996 KB Output is correct
19 Correct 5 ms 6996 KB Output is correct
20 Correct 5 ms 6868 KB Output is correct
21 Correct 7 ms 6996 KB Output is correct
22 Correct 7 ms 6868 KB Output is correct
23 Correct 5 ms 6892 KB Output is correct
24 Correct 8 ms 6996 KB Output is correct
25 Correct 5 ms 6980 KB Output is correct
26 Correct 6 ms 6908 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
5 Correct 2 ms 1364 KB Output is correct
6 Correct 1 ms 1356 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1364 KB Output is correct
9 Correct 1 ms 1352 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1364 KB Output is correct
12 Correct 1 ms 1364 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 6 ms 6740 KB Output is correct
15 Correct 2 ms 4944 KB Output is correct
16 Correct 3 ms 3796 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 7 ms 6996 KB Output is correct
19 Correct 5 ms 6996 KB Output is correct
20 Correct 5 ms 6868 KB Output is correct
21 Correct 7 ms 6996 KB Output is correct
22 Correct 7 ms 6868 KB Output is correct
23 Correct 5 ms 6892 KB Output is correct
24 Correct 8 ms 6996 KB Output is correct
25 Correct 5 ms 6980 KB Output is correct
26 Correct 6 ms 6908 KB Output is correct
27 Correct 206 ms 52608 KB Output is correct
28 Correct 10 ms 25812 KB Output is correct
29 Correct 7 ms 4692 KB Output is correct
30 Correct 1 ms 468 KB Output is correct
31 Correct 166 ms 43300 KB Output is correct
32 Correct 130 ms 53144 KB Output is correct
33 Correct 125 ms 53044 KB Output is correct
34 Correct 184 ms 50032 KB Output is correct
35 Correct 137 ms 53152 KB Output is correct
36 Correct 124 ms 52960 KB Output is correct
37 Correct 215 ms 53148 KB Output is correct
38 Correct 93 ms 43240 KB Output is correct
39 Correct 88 ms 43020 KB Output is correct