답안 #102697

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
102697 2019-03-26T23:47:26 Z dsjong Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
331 ms 83320 KB
#include<bits/stdc++.h>
using namespace std;
int O[3005][3005];
int I[3005][3005];
char c[3005][3005];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int H,W;
	cin>>H>>W;
	for(int i=1;i<=H;i++){
		for(int j=1;j<=W;j++){
			cin>>c[i][j];
			O[i][j]=O[i-1][j]+O[i][j-1]-O[i-1][j-1];
			I[i][j]=I[i-1][j]+I[i][j-1]-I[i-1][j-1];
			if(c[i][j]=='O') O[i][j]++;
			if(c[i][j]=='I') I[i][j]++;
		}
	}
	long long ans=0;
	for(int i=1;i<=H;i++){
		for(int j=1;j<=W;j++){
			if(c[i][j]=='J'){
				long long a=O[i][W]-O[i-1][W]-O[i][j]+O[i-1][j];
				long long b=I[H][j]-I[H][j-1]-I[i][j]+I[i][j-1];
				ans+=a*b;
			}
		}
	}
	cout<<ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 512 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 4 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 4 ms 1408 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 3 ms 1408 KB Output is correct
10 Correct 3 ms 1408 KB Output is correct
11 Correct 3 ms 1536 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 4 ms 1408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 512 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 4 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 4 ms 1408 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 3 ms 1408 KB Output is correct
10 Correct 3 ms 1408 KB Output is correct
11 Correct 3 ms 1536 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 4 ms 1408 KB Output is correct
14 Correct 14 ms 7424 KB Output is correct
15 Correct 6 ms 4992 KB Output is correct
16 Correct 7 ms 4280 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 16 ms 7936 KB Output is correct
19 Correct 13 ms 7808 KB Output is correct
20 Correct 15 ms 7808 KB Output is correct
21 Correct 19 ms 7992 KB Output is correct
22 Correct 14 ms 7808 KB Output is correct
23 Correct 14 ms 7808 KB Output is correct
24 Correct 17 ms 7936 KB Output is correct
25 Correct 14 ms 7808 KB Output is correct
26 Correct 16 ms 7808 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 512 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 4 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 4 ms 1408 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 3 ms 1408 KB Output is correct
10 Correct 3 ms 1408 KB Output is correct
11 Correct 3 ms 1536 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 4 ms 1408 KB Output is correct
14 Correct 14 ms 7424 KB Output is correct
15 Correct 6 ms 4992 KB Output is correct
16 Correct 7 ms 4280 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 16 ms 7936 KB Output is correct
19 Correct 13 ms 7808 KB Output is correct
20 Correct 15 ms 7808 KB Output is correct
21 Correct 19 ms 7992 KB Output is correct
22 Correct 14 ms 7808 KB Output is correct
23 Correct 14 ms 7808 KB Output is correct
24 Correct 17 ms 7936 KB Output is correct
25 Correct 14 ms 7808 KB Output is correct
26 Correct 16 ms 7808 KB Output is correct
27 Correct 301 ms 83320 KB Output is correct
28 Correct 26 ms 26104 KB Output is correct
29 Correct 17 ms 7680 KB Output is correct
30 Correct 3 ms 640 KB Output is correct
31 Correct 225 ms 70072 KB Output is correct
32 Correct 234 ms 83288 KB Output is correct
33 Correct 202 ms 82936 KB Output is correct
34 Correct 331 ms 80656 KB Output is correct
35 Correct 291 ms 83200 KB Output is correct
36 Correct 201 ms 82936 KB Output is correct
37 Correct 320 ms 83192 KB Output is correct
38 Correct 195 ms 70008 KB Output is correct
39 Correct 158 ms 69752 KB Output is correct