답안 #508549

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
508549 2022-01-13T12:04:35 Z CSQ31 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
575 ms 88328 KB
#include <bits/stdc++.h>
using namespace std;
char g[3000][3000];
int a[3000][3000],b[3000][3000];
int main()
{
	int h,w;
	cin>>h>>w;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>g[i][j];
			a[i][j] = g[i][j] == 'O';
			b[i][j] = g[i][j] == 'I';
			if(j)a[i][j]+=a[i][j-1];
			if(i)b[i][j]+=b[i-1][j];	
		}
	}
	long long int ans = 0;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(g[i][j] == 'J'){
				ans+=(b[h-1][j] - b[i][j]) * 1LL * (a[i][w-1] - a[i][j]);
				
			}	
		}
	}
	cout<<ans;
	
	
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 292 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 2 ms 1484 KB Output is correct
6 Correct 1 ms 1440 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 2 ms 1484 KB Output is correct
9 Correct 1 ms 1452 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 2 ms 1484 KB Output is correct
12 Correct 1 ms 1456 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 292 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 2 ms 1484 KB Output is correct
6 Correct 1 ms 1440 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 2 ms 1484 KB Output is correct
9 Correct 1 ms 1452 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 2 ms 1484 KB Output is correct
12 Correct 1 ms 1456 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 14 ms 7428 KB Output is correct
15 Correct 3 ms 4960 KB Output is correct
16 Correct 10 ms 4248 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 18 ms 7856 KB Output is correct
19 Correct 17 ms 7836 KB Output is correct
20 Correct 19 ms 7756 KB Output is correct
21 Correct 18 ms 7868 KB Output is correct
22 Correct 17 ms 7732 KB Output is correct
23 Correct 17 ms 7732 KB Output is correct
24 Correct 18 ms 7868 KB Output is correct
25 Correct 20 ms 7756 KB Output is correct
26 Correct 17 ms 7748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 292 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 2 ms 1484 KB Output is correct
6 Correct 1 ms 1440 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 2 ms 1484 KB Output is correct
9 Correct 1 ms 1452 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 2 ms 1484 KB Output is correct
12 Correct 1 ms 1456 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 14 ms 7428 KB Output is correct
15 Correct 3 ms 4960 KB Output is correct
16 Correct 10 ms 4248 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 18 ms 7856 KB Output is correct
19 Correct 17 ms 7836 KB Output is correct
20 Correct 19 ms 7756 KB Output is correct
21 Correct 18 ms 7868 KB Output is correct
22 Correct 17 ms 7732 KB Output is correct
23 Correct 17 ms 7732 KB Output is correct
24 Correct 18 ms 7868 KB Output is correct
25 Correct 20 ms 7756 KB Output is correct
26 Correct 17 ms 7748 KB Output is correct
27 Correct 571 ms 87888 KB Output is correct
28 Correct 14 ms 25908 KB Output is correct
29 Correct 41 ms 7676 KB Output is correct
30 Correct 2 ms 588 KB Output is correct
31 Correct 381 ms 72432 KB Output is correct
32 Correct 539 ms 88244 KB Output is correct
33 Correct 521 ms 88024 KB Output is correct
34 Correct 485 ms 83960 KB Output is correct
35 Correct 534 ms 88208 KB Output is correct
36 Correct 527 ms 87932 KB Output is correct
37 Correct 575 ms 88328 KB Output is correct
38 Correct 380 ms 72448 KB Output is correct
39 Correct 373 ms 72064 KB Output is correct