답안 #97402

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
97402 2019-02-15T17:46:48 Z MatheusLealV Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
296 ms 151636 KB
#include <bits/stdc++.h>
#define N 3030
using namespace std;
typedef long long ll;

int n, m;

ll ans, I[N][N], O[N][N];

char mat[N][N];

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

	cin>>n>>m;

	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
			cin>>mat[i][j];

	for(int i = n; i >= 1; i--)
	{
		for(int j = m; j >= 1; j--)
		{
			I[i][j] = I[i + 1][j] + (mat[i][j] == 'I');

			O[i][j] = O[i][j + 1] + (mat[i][j] == 'O');

			if(mat[i][j] == 'J') ans += I[i][j] * O[i][j];
		}
	}

	cout<<ans<<"\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 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 3 ms 1536 KB Output is correct
6 Correct 3 ms 1664 KB Output is correct
7 Correct 3 ms 1536 KB Output is correct
8 Correct 3 ms 1664 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 3 ms 1664 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 3 ms 1536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 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 3 ms 1536 KB Output is correct
6 Correct 3 ms 1664 KB Output is correct
7 Correct 3 ms 1536 KB Output is correct
8 Correct 3 ms 1664 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 3 ms 1664 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 3 ms 1536 KB Output is correct
14 Correct 14 ms 8832 KB Output is correct
15 Correct 6 ms 5120 KB Output is correct
16 Correct 10 ms 5376 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 15 ms 9856 KB Output is correct
19 Correct 13 ms 9600 KB Output is correct
20 Correct 16 ms 9600 KB Output is correct
21 Correct 17 ms 9848 KB Output is correct
22 Correct 16 ms 9600 KB Output is correct
23 Correct 16 ms 9592 KB Output is correct
24 Correct 17 ms 10020 KB Output is correct
25 Correct 12 ms 9728 KB Output is correct
26 Correct 13 ms 9600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 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 3 ms 1536 KB Output is correct
6 Correct 3 ms 1664 KB Output is correct
7 Correct 3 ms 1536 KB Output is correct
8 Correct 3 ms 1664 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 3 ms 1664 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 3 ms 1536 KB Output is correct
14 Correct 14 ms 8832 KB Output is correct
15 Correct 6 ms 5120 KB Output is correct
16 Correct 10 ms 5376 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 15 ms 9856 KB Output is correct
19 Correct 13 ms 9600 KB Output is correct
20 Correct 16 ms 9600 KB Output is correct
21 Correct 17 ms 9848 KB Output is correct
22 Correct 16 ms 9600 KB Output is correct
23 Correct 16 ms 9592 KB Output is correct
24 Correct 17 ms 10020 KB Output is correct
25 Correct 12 ms 9728 KB Output is correct
26 Correct 13 ms 9600 KB Output is correct
27 Correct 296 ms 151636 KB Output is correct
28 Correct 28 ms 26368 KB Output is correct
29 Correct 21 ms 13304 KB Output is correct
30 Correct 3 ms 896 KB Output is correct
31 Correct 202 ms 125688 KB Output is correct
32 Correct 252 ms 151544 KB Output is correct
33 Correct 274 ms 151000 KB Output is correct
34 Correct 253 ms 145656 KB Output is correct
35 Correct 232 ms 151520 KB Output is correct
36 Correct 230 ms 151032 KB Output is correct
37 Correct 273 ms 151544 KB Output is correct
38 Correct 219 ms 124968 KB Output is correct
39 Correct 195 ms 125176 KB Output is correct