답안 #716193

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
716193 2023-03-29T08:29:00 Z shoryu386 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
357 ms 150024 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n, m; cin >> n >> m;
	char arr[n][m];
	for (int x = n-1; x > -1; x--){
		for (int y = 0; y < m; y++) cin >> arr[x][y];
	}
	
	int OpsumHori[n][m], IpsumVert[n][m];
	for (int x = 0; x < n; x++){
		OpsumHori[x][m-1] = (arr[x][m-1] == 'O');
		for (int y = m-2; y > -1; y--){
			OpsumHori[x][y] = OpsumHori[x][y+1] + (arr[x][y] == 'O');
		}
	}
	
	for (int y = 0; y < m; y++){
		IpsumVert[0][y] = (arr[0][y] == 'I');
		for (int x = 1; x < n; x++){
			IpsumVert[x][y] = IpsumVert[x-1][y] + (arr[x][y] == 'I');
		}
	}
	
	int ans = 0;
	for (int x = 0; x < n; x++){
		for (int y = 0; y < m; y++){
			if (arr[x][y] == 'J') ans += OpsumHori[x][y] * IpsumVert[x][y];
		}
	}
	
	cout << ans;
}

Compilation message

joi2019_ho_t1.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 372 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 372 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
14 Correct 5 ms 3412 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 3 ms 2388 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 7 ms 4436 KB Output is correct
19 Correct 6 ms 4180 KB Output is correct
20 Correct 8 ms 4308 KB Output is correct
21 Correct 8 ms 4472 KB Output is correct
22 Correct 6 ms 4264 KB Output is correct
23 Correct 6 ms 4308 KB Output is correct
24 Correct 7 ms 4436 KB Output is correct
25 Correct 6 ms 4204 KB Output is correct
26 Correct 6 ms 4308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 372 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
14 Correct 5 ms 3412 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 3 ms 2388 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 7 ms 4436 KB Output is correct
19 Correct 6 ms 4180 KB Output is correct
20 Correct 8 ms 4308 KB Output is correct
21 Correct 8 ms 4472 KB Output is correct
22 Correct 6 ms 4264 KB Output is correct
23 Correct 6 ms 4308 KB Output is correct
24 Correct 7 ms 4436 KB Output is correct
25 Correct 6 ms 4204 KB Output is correct
26 Correct 6 ms 4308 KB Output is correct
27 Correct 322 ms 141668 KB Output is correct
28 Correct 1 ms 724 KB Output is correct
29 Correct 16 ms 10964 KB Output is correct
30 Correct 1 ms 596 KB Output is correct
31 Correct 256 ms 104336 KB Output is correct
32 Correct 320 ms 148996 KB Output is correct
33 Correct 343 ms 149500 KB Output is correct
34 Correct 268 ms 120892 KB Output is correct
35 Correct 336 ms 149012 KB Output is correct
36 Correct 317 ms 149508 KB Output is correct
37 Correct 357 ms 150024 KB Output is correct
38 Correct 220 ms 103424 KB Output is correct
39 Correct 210 ms 103836 KB Output is correct