답안 #864191

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
864191 2023-10-22T08:18:35 Z MongHwa Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
186 ms 160188 KB
#include <iostream>
using namespace std;

#define ll long long

string stage[3001];
ll psum1[3005][3005], psum2[3005][3005];

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);

	int h, w;
	cin >> h >> w;

	for(int i = 0; i < h; i++)
		cin >> stage[i];

	for(int i = h-1; i >= 0; i--)
		for(int j = w-1; j >= 0; j--)
		{
			psum1[i][j] = psum1[i][j+1];
			if(stage[i][j] == 'O')
				psum1[i][j]++;

			psum2[j][i] = psum2[j][i+1];
			if(stage[i][j] == 'I')
				psum2[j][i]++;
		}

	ll ans = 0;
	for(int i = 0; i < h; i++)
		for(int j = 0; j < w; j++)
			if(stage[i][j] == 'J')
				ans += psum1[i][j]*psum2[j][i];

	cout << ans << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 1 ms 1624 KB Output is correct
6 Correct 1 ms 1372 KB Output is correct
7 Correct 1 ms 1372 KB Output is correct
8 Correct 1 ms 1372 KB Output is correct
9 Correct 1 ms 1372 KB Output is correct
10 Correct 1 ms 1372 KB Output is correct
11 Correct 1 ms 1332 KB Output is correct
12 Correct 2 ms 1372 KB Output is correct
13 Correct 1 ms 1372 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 1 ms 1624 KB Output is correct
6 Correct 1 ms 1372 KB Output is correct
7 Correct 1 ms 1372 KB Output is correct
8 Correct 1 ms 1372 KB Output is correct
9 Correct 1 ms 1372 KB Output is correct
10 Correct 1 ms 1372 KB Output is correct
11 Correct 1 ms 1332 KB Output is correct
12 Correct 2 ms 1372 KB Output is correct
13 Correct 1 ms 1372 KB Output is correct
14 Correct 6 ms 10552 KB Output is correct
15 Correct 1 ms 2140 KB Output is correct
16 Correct 4 ms 7256 KB Output is correct
17 Correct 1 ms 1628 KB Output is correct
18 Correct 8 ms 11692 KB Output is correct
19 Correct 5 ms 11356 KB Output is correct
20 Correct 6 ms 10244 KB Output is correct
21 Correct 7 ms 11604 KB Output is correct
22 Correct 6 ms 11328 KB Output is correct
23 Correct 5 ms 10076 KB Output is correct
24 Correct 8 ms 11612 KB Output is correct
25 Correct 5 ms 11324 KB Output is correct
26 Correct 5 ms 10044 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 1 ms 1624 KB Output is correct
6 Correct 1 ms 1372 KB Output is correct
7 Correct 1 ms 1372 KB Output is correct
8 Correct 1 ms 1372 KB Output is correct
9 Correct 1 ms 1372 KB Output is correct
10 Correct 1 ms 1372 KB Output is correct
11 Correct 1 ms 1332 KB Output is correct
12 Correct 2 ms 1372 KB Output is correct
13 Correct 1 ms 1372 KB Output is correct
14 Correct 6 ms 10552 KB Output is correct
15 Correct 1 ms 2140 KB Output is correct
16 Correct 4 ms 7256 KB Output is correct
17 Correct 1 ms 1628 KB Output is correct
18 Correct 8 ms 11692 KB Output is correct
19 Correct 5 ms 11356 KB Output is correct
20 Correct 6 ms 10244 KB Output is correct
21 Correct 7 ms 11604 KB Output is correct
22 Correct 6 ms 11328 KB Output is correct
23 Correct 5 ms 10076 KB Output is correct
24 Correct 8 ms 11612 KB Output is correct
25 Correct 5 ms 11324 KB Output is correct
26 Correct 5 ms 10044 KB Output is correct
27 Correct 184 ms 155824 KB Output is correct
28 Correct 5 ms 10340 KB Output is correct
29 Correct 14 ms 23052 KB Output is correct
30 Correct 5 ms 10076 KB Output is correct
31 Correct 138 ms 130712 KB Output is correct
32 Correct 154 ms 159432 KB Output is correct
33 Correct 141 ms 159684 KB Output is correct
34 Correct 149 ms 142276 KB Output is correct
35 Correct 148 ms 159440 KB Output is correct
36 Correct 150 ms 159848 KB Output is correct
37 Correct 186 ms 160188 KB Output is correct
38 Correct 97 ms 130216 KB Output is correct
39 Correct 106 ms 130452 KB Output is correct