답안 #317287

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
317287 2020-10-29T09:52:39 Z nandonathaniel Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
371 ms 88716 KB
#include<bits/stdc++.h>
using namespace std;
const int MAXN=3005;

char a[MAXN][MAXN];
int sufO[MAXN][MAXN],sufI[MAXN][MAXN];

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n,m;
	cin >> n >> m;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++)cin >> a[i][j];
	}
	for(int i=1;i<=n;i++){
		for(int j=m;j>=1;j--){
			sufO[i][j]=sufO[i][j+1];
			if(a[i][j]=='O')sufO[i][j]++;
		}
	}
	for(int i=1;i<=m;i++){
		for(int j=n;j>=1;j--){
			sufI[i][j]=sufI[i][j+1];
			if(a[j][i]=='I')sufI[i][j]++;
		}
	}
	long long ans=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(a[i][j]=='J'){
				ans+=(sufO[i][j+1]*sufI[j][i+1]);
			}
		}
	}
	cout << ans << '\n';
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 2 ms 1536 KB Output is correct
6 Correct 1 ms 1408 KB Output is correct
7 Correct 2 ms 1408 KB Output is correct
8 Correct 1 ms 1536 KB Output is correct
9 Correct 1 ms 1408 KB Output is correct
10 Correct 1 ms 1408 KB Output is correct
11 Correct 2 ms 1536 KB Output is correct
12 Correct 1 ms 1408 KB Output is correct
13 Correct 1 ms 1408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 2 ms 1536 KB Output is correct
6 Correct 1 ms 1408 KB Output is correct
7 Correct 2 ms 1408 KB Output is correct
8 Correct 1 ms 1536 KB Output is correct
9 Correct 1 ms 1408 KB Output is correct
10 Correct 1 ms 1408 KB Output is correct
11 Correct 2 ms 1536 KB Output is correct
12 Correct 1 ms 1408 KB Output is correct
13 Correct 1 ms 1408 KB Output is correct
14 Correct 11 ms 7040 KB Output is correct
15 Correct 2 ms 3328 KB Output is correct
16 Correct 7 ms 5248 KB Output is correct
17 Correct 1 ms 1664 KB Output is correct
18 Correct 12 ms 8064 KB Output is correct
19 Correct 10 ms 7808 KB Output is correct
20 Correct 10 ms 7840 KB Output is correct
21 Correct 13 ms 8064 KB Output is correct
22 Correct 12 ms 7808 KB Output is correct
23 Correct 10 ms 7936 KB Output is correct
24 Correct 13 ms 8064 KB Output is correct
25 Correct 11 ms 7936 KB Output is correct
26 Correct 10 ms 7936 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 2 ms 1536 KB Output is correct
6 Correct 1 ms 1408 KB Output is correct
7 Correct 2 ms 1408 KB Output is correct
8 Correct 1 ms 1536 KB Output is correct
9 Correct 1 ms 1408 KB Output is correct
10 Correct 1 ms 1408 KB Output is correct
11 Correct 2 ms 1536 KB Output is correct
12 Correct 1 ms 1408 KB Output is correct
13 Correct 1 ms 1408 KB Output is correct
14 Correct 11 ms 7040 KB Output is correct
15 Correct 2 ms 3328 KB Output is correct
16 Correct 7 ms 5248 KB Output is correct
17 Correct 1 ms 1664 KB Output is correct
18 Correct 12 ms 8064 KB Output is correct
19 Correct 10 ms 7808 KB Output is correct
20 Correct 10 ms 7840 KB Output is correct
21 Correct 13 ms 8064 KB Output is correct
22 Correct 12 ms 7808 KB Output is correct
23 Correct 10 ms 7936 KB Output is correct
24 Correct 13 ms 8064 KB Output is correct
25 Correct 11 ms 7936 KB Output is correct
26 Correct 10 ms 7936 KB Output is correct
27 Correct 340 ms 86008 KB Output is correct
28 Correct 11 ms 16768 KB Output is correct
29 Correct 27 ms 17408 KB Output is correct
30 Correct 8 ms 9856 KB Output is correct
31 Correct 255 ms 72664 KB Output is correct
32 Correct 301 ms 88256 KB Output is correct
33 Correct 320 ms 88444 KB Output is correct
34 Correct 296 ms 79480 KB Output is correct
35 Correct 316 ms 88440 KB Output is correct
36 Correct 312 ms 88580 KB Output is correct
37 Correct 371 ms 88716 KB Output is correct
38 Correct 208 ms 72312 KB Output is correct
39 Correct 219 ms 72440 KB Output is correct