Submission #444128

# Submission time Handle Problem Language Result Execution time Memory
444128 2021-07-13T06:47:13 Z nonsensenonsense1 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
142 ms 88292 KB
#include <cstdio>

const int N = 3001;
int h, w, o[N][N], in[N][N];
char s[N][N];

int main() 
{
	scanf("%d%d", &h, &w);
	for (int i = 0; i < h; ++i) scanf("%s", s[i]);
	long long ans = 0;
	for (int i = h - 1; i >= 0; --i) {
		for (int j = w - 1; j >= 0; --j) {
			o[i][j] = o[i][j + 1] + (s[i][j] == 'O');
			in[i][j] = in[i + 1][j] + (s[i][j] == 'I');
			if (s[i][j] == 'J') ans += o[i][j] * in[i][j];
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf("%d%d", &h, &w);
      |  ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:10:35: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  for (int i = 0; i < h; ++i) scanf("%s", s[i]);
      |                              ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 288 KB Output is correct
3 Correct 0 ms 288 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 1356 KB Output is correct
6 Correct 1 ms 1356 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1448 KB Output is correct
9 Correct 1 ms 1356 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1356 KB Output is correct
12 Correct 1 ms 1432 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 288 KB Output is correct
3 Correct 0 ms 288 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 1356 KB Output is correct
6 Correct 1 ms 1356 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1448 KB Output is correct
9 Correct 1 ms 1356 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1356 KB Output is correct
12 Correct 1 ms 1432 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 6 ms 7460 KB Output is correct
15 Correct 3 ms 4940 KB Output is correct
16 Correct 3 ms 4172 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 6 ms 7884 KB Output is correct
19 Correct 6 ms 7884 KB Output is correct
20 Correct 6 ms 7756 KB Output is correct
21 Correct 6 ms 7884 KB Output is correct
22 Correct 6 ms 7884 KB Output is correct
23 Correct 6 ms 7828 KB Output is correct
24 Correct 6 ms 7884 KB Output is correct
25 Correct 6 ms 7884 KB Output is correct
26 Correct 6 ms 7720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 288 KB Output is correct
3 Correct 0 ms 288 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 1356 KB Output is correct
6 Correct 1 ms 1356 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1448 KB Output is correct
9 Correct 1 ms 1356 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1356 KB Output is correct
12 Correct 1 ms 1432 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 6 ms 7460 KB Output is correct
15 Correct 3 ms 4940 KB Output is correct
16 Correct 3 ms 4172 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 6 ms 7884 KB Output is correct
19 Correct 6 ms 7884 KB Output is correct
20 Correct 6 ms 7756 KB Output is correct
21 Correct 6 ms 7884 KB Output is correct
22 Correct 6 ms 7884 KB Output is correct
23 Correct 6 ms 7828 KB Output is correct
24 Correct 6 ms 7884 KB Output is correct
25 Correct 6 ms 7884 KB Output is correct
26 Correct 6 ms 7720 KB Output is correct
27 Correct 115 ms 87740 KB Output is correct
28 Correct 15 ms 25912 KB Output is correct
29 Correct 8 ms 7756 KB Output is correct
30 Correct 1 ms 588 KB Output is correct
31 Correct 89 ms 72448 KB Output is correct
32 Correct 96 ms 88224 KB Output is correct
33 Correct 123 ms 88004 KB Output is correct
34 Correct 113 ms 84000 KB Output is correct
35 Correct 99 ms 88292 KB Output is correct
36 Correct 97 ms 88000 KB Output is correct
37 Correct 142 ms 88240 KB Output is correct
38 Correct 73 ms 72388 KB Output is correct
39 Correct 74 ms 72140 KB Output is correct