답안 #287344

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
287344 2020-08-31T16:03:32 Z reymontada61 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
801 ms 159292 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long
const int MXN = 3005;
int h, w;
string grid[MXN];
int sufo[MXN][MXN];
int lowi[MXN][MXN];

signed main() {

	cin >> h >> w;
	for (int i=1; i<=h; i++) {
		cin >> grid[i];
		grid[i] = ' ' + grid[i];
	}
	
	for (int i=1; i<=h; i++) {
		for (int j=w; j>=1; j--) {
			sufo[i][j] = sufo[i][j+1];
			if (grid[i][j] == 'O') {
				sufo[i][j]++;
			}
		}
	}
	
	for (int j=1; j<=w; j++) {
		for (int i=h; i>=1; i--) {
			lowi[i][j] = lowi[i+1][j];
			if (grid[i][j] == 'I') {
				lowi[i][j]++;
			}
		}
	}
	
	int x = 0;
	for (int i=1; i<=h; i++) {
		for (int j=1; j<=w; j++) {
			if (grid[i][j] == 'J') {
				x += (sufo[i][j] * lowi[i][j]);
			}
		}
	}
	
	cout << x << endl;
	
	

}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 2 ms 1408 KB Output is correct
6 Correct 2 ms 1408 KB Output is correct
7 Correct 2 ms 1280 KB Output is correct
8 Correct 2 ms 1408 KB Output is correct
9 Correct 1 ms 1408 KB Output is correct
10 Correct 2 ms 1280 KB Output is correct
11 Correct 2 ms 1408 KB Output is correct
12 Correct 2 ms 1408 KB Output is correct
13 Correct 2 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 0 ms 384 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 2 ms 1408 KB Output is correct
6 Correct 2 ms 1408 KB Output is correct
7 Correct 2 ms 1280 KB Output is correct
8 Correct 2 ms 1408 KB Output is correct
9 Correct 1 ms 1408 KB Output is correct
10 Correct 2 ms 1280 KB Output is correct
11 Correct 2 ms 1408 KB Output is correct
12 Correct 2 ms 1408 KB Output is correct
13 Correct 2 ms 1408 KB Output is correct
14 Correct 17 ms 7808 KB Output is correct
15 Correct 3 ms 3968 KB Output is correct
16 Correct 10 ms 4736 KB Output is correct
17 Correct 1 ms 512 KB Output is correct
18 Correct 21 ms 8880 KB Output is correct
19 Correct 18 ms 8704 KB Output is correct
20 Correct 18 ms 8704 KB Output is correct
21 Correct 21 ms 8832 KB Output is correct
22 Correct 18 ms 8704 KB Output is correct
23 Correct 18 ms 8704 KB Output is correct
24 Correct 21 ms 8824 KB Output is correct
25 Correct 19 ms 8704 KB Output is correct
26 Correct 21 ms 8704 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 0 ms 384 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 2 ms 1408 KB Output is correct
6 Correct 2 ms 1408 KB Output is correct
7 Correct 2 ms 1280 KB Output is correct
8 Correct 2 ms 1408 KB Output is correct
9 Correct 1 ms 1408 KB Output is correct
10 Correct 2 ms 1280 KB Output is correct
11 Correct 2 ms 1408 KB Output is correct
12 Correct 2 ms 1408 KB Output is correct
13 Correct 2 ms 1408 KB Output is correct
14 Correct 17 ms 7808 KB Output is correct
15 Correct 3 ms 3968 KB Output is correct
16 Correct 10 ms 4736 KB Output is correct
17 Correct 1 ms 512 KB Output is correct
18 Correct 21 ms 8880 KB Output is correct
19 Correct 18 ms 8704 KB Output is correct
20 Correct 18 ms 8704 KB Output is correct
21 Correct 21 ms 8832 KB Output is correct
22 Correct 18 ms 8704 KB Output is correct
23 Correct 18 ms 8704 KB Output is correct
24 Correct 21 ms 8824 KB Output is correct
25 Correct 19 ms 8704 KB Output is correct
26 Correct 21 ms 8704 KB Output is correct
27 Correct 748 ms 158332 KB Output is correct
28 Correct 13 ms 19584 KB Output is correct
29 Correct 44 ms 13816 KB Output is correct
30 Correct 3 ms 896 KB Output is correct
31 Correct 530 ms 130296 KB Output is correct
32 Correct 704 ms 159096 KB Output is correct
33 Correct 717 ms 158684 KB Output is correct
34 Correct 632 ms 151032 KB Output is correct
35 Correct 732 ms 159080 KB Output is correct
36 Correct 758 ms 158784 KB Output is correct
37 Correct 801 ms 159292 KB Output is correct
38 Correct 554 ms 129712 KB Output is correct
39 Correct 512 ms 129724 KB Output is correct