답안 #110332

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
110332 2019-05-10T17:33:20 Z sofhiasouza Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
915 ms 79992 KB
#include <bits/stdc++.h>
#define MAXN 3010
using namespace std;

int h, w, qorb[MAXN][MAXN], qing[MAXN][MAXN];
char s[MAXN][MAXN];

int main()
{
	cin >> h >> w;
	for(int i = 1 ; i <= h ; i++)
	{
		for(int j = 1 ; j <= w ; j++)
		{
			cin >> s[i][j];
			qorb[i][j] = qorb[i][j-1];
			if(s[i][j] == 'O') qorb[i][j]++;
		}
	}
	for(int j = 1 ; j <= w ; j++)
	{
		for(int i = 1 ; i <= h ; i++)
		{
			qing[i][j] = qing[i-1][j];
			if(s[i][j] == 'I') qing[i][j]++;
		}
	}
	long long int sum = 0;
	for(int i = 1 ; i <= h ; i++)
	{
		for(int j = 1 ; j <= w ; j++)
		{
			if(s[i][j] == 'J')
			{
				long long int v = (qorb[i][w] - qorb[i][j])*(qing[h][j] - qing[i][j]);
				sum += v;
			}
		}
	}
	cout << sum << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 512 KB Output is correct
5 Correct 4 ms 1536 KB Output is correct
6 Correct 4 ms 1536 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 5 ms 1544 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 5 ms 1408 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 512 KB Output is correct
5 Correct 4 ms 1536 KB Output is correct
6 Correct 4 ms 1536 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 5 ms 1544 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 5 ms 1408 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
14 Correct 23 ms 7296 KB Output is correct
15 Correct 9 ms 4992 KB Output is correct
16 Correct 18 ms 4196 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 33 ms 7800 KB Output is correct
19 Correct 23 ms 7680 KB Output is correct
20 Correct 22 ms 7672 KB Output is correct
21 Correct 24 ms 7800 KB Output is correct
22 Correct 22 ms 7680 KB Output is correct
23 Correct 24 ms 7552 KB Output is correct
24 Correct 32 ms 7800 KB Output is correct
25 Correct 29 ms 7704 KB Output is correct
26 Correct 28 ms 7792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 512 KB Output is correct
5 Correct 4 ms 1536 KB Output is correct
6 Correct 4 ms 1536 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 5 ms 1544 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 5 ms 1408 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
14 Correct 23 ms 7296 KB Output is correct
15 Correct 9 ms 4992 KB Output is correct
16 Correct 18 ms 4196 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 33 ms 7800 KB Output is correct
19 Correct 23 ms 7680 KB Output is correct
20 Correct 22 ms 7672 KB Output is correct
21 Correct 24 ms 7800 KB Output is correct
22 Correct 22 ms 7680 KB Output is correct
23 Correct 24 ms 7552 KB Output is correct
24 Correct 32 ms 7800 KB Output is correct
25 Correct 29 ms 7704 KB Output is correct
26 Correct 28 ms 7792 KB Output is correct
27 Correct 845 ms 79768 KB Output is correct
28 Correct 29 ms 26112 KB Output is correct
29 Correct 53 ms 7160 KB Output is correct
30 Correct 5 ms 640 KB Output is correct
31 Correct 642 ms 66908 KB Output is correct
32 Correct 836 ms 79864 KB Output is correct
33 Correct 915 ms 79864 KB Output is correct
34 Correct 755 ms 77260 KB Output is correct
35 Correct 858 ms 79992 KB Output is correct
36 Correct 740 ms 79700 KB Output is correct
37 Correct 872 ms 79992 KB Output is correct
38 Correct 586 ms 66732 KB Output is correct
39 Correct 545 ms 66364 KB Output is correct