답안 #110316

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
110316 2019-05-10T17:15:12 Z luciocf Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
869 ms 88780 KB
#include <bits/stdc++.h>

using namespace std;

const int maxn = 3e3+10;

int prefL[maxn][maxn], prefC[maxn][maxn];

char tab[maxn][maxn];

int main(void)
{
	int n, m;
	scanf("%d %d", &n, &m);

	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
			scanf(" %c", &tab[i][j]);

	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			prefL[i][j] = prefL[i][j-1];

			if (tab[i][j] == 'O')
				prefL[i][j]++;
		}
	}

	for (int j = 1; j <= m; j++)
	{
		for (int i = 1; i <= n; i++)
		{
			prefC[i][j] = prefC[i-1][j];

			if (tab[i][j] == 'I')
				prefC[i][j]++;
		}
	}

	long long ans = 0ll;

	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
			if (tab[i][j] == 'J')
				ans += 1ll*(prefL[i][m]-prefL[i][j])*(prefC[n][j]-prefC[i][j]);

	printf("%lld\n", ans);
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &m);
  ~~~~~^~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:18:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf(" %c", &tab[i][j]);
    ~~~~~^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 4 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 4 ms 1408 KB Output is correct
8 Correct 3 ms 1536 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 4 ms 1536 KB Output is correct
13 Correct 4 ms 1408 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 3 ms 384 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 4 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 4 ms 1408 KB Output is correct
8 Correct 3 ms 1536 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 4 ms 1536 KB Output is correct
13 Correct 4 ms 1408 KB Output is correct
14 Correct 23 ms 7416 KB Output is correct
15 Correct 8 ms 4964 KB Output is correct
16 Correct 18 ms 4224 KB Output is correct
17 Correct 3 ms 384 KB Output is correct
18 Correct 25 ms 8064 KB Output is correct
19 Correct 27 ms 7936 KB Output is correct
20 Correct 25 ms 7800 KB Output is correct
21 Correct 38 ms 7928 KB Output is correct
22 Correct 25 ms 7908 KB Output is correct
23 Correct 34 ms 7800 KB Output is correct
24 Correct 29 ms 8056 KB Output is correct
25 Correct 31 ms 7936 KB Output is correct
26 Correct 28 ms 7800 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 3 ms 384 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 4 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 4 ms 1408 KB Output is correct
8 Correct 3 ms 1536 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 4 ms 1536 KB Output is correct
13 Correct 4 ms 1408 KB Output is correct
14 Correct 23 ms 7416 KB Output is correct
15 Correct 8 ms 4964 KB Output is correct
16 Correct 18 ms 4224 KB Output is correct
17 Correct 3 ms 384 KB Output is correct
18 Correct 25 ms 8064 KB Output is correct
19 Correct 27 ms 7936 KB Output is correct
20 Correct 25 ms 7800 KB Output is correct
21 Correct 38 ms 7928 KB Output is correct
22 Correct 25 ms 7908 KB Output is correct
23 Correct 34 ms 7800 KB Output is correct
24 Correct 29 ms 8056 KB Output is correct
25 Correct 31 ms 7936 KB Output is correct
26 Correct 28 ms 7800 KB Output is correct
27 Correct 804 ms 88276 KB Output is correct
28 Correct 31 ms 25976 KB Output is correct
29 Correct 60 ms 7800 KB Output is correct
30 Correct 3 ms 640 KB Output is correct
31 Correct 575 ms 72696 KB Output is correct
32 Correct 797 ms 88780 KB Output is correct
33 Correct 730 ms 88444 KB Output is correct
34 Correct 661 ms 84276 KB Output is correct
35 Correct 801 ms 88740 KB Output is correct
36 Correct 786 ms 88440 KB Output is correct
37 Correct 869 ms 88732 KB Output is correct
38 Correct 608 ms 72644 KB Output is correct
39 Correct 538 ms 72516 KB Output is correct