Submission #97384

# Submission time Handle Problem Language Result Execution time Memory
97384 2019-02-15T16:57:07 Z Bruteforceman Bitaro the Brave (JOI19_ho_t1) C++11
100 / 100
157 ms 44664 KB
#include "bits/stdc++.h"
using namespace std;
char s[3003][3003];
int cnt[3003][3003];

int main(int argc, char const *argv[])
{
	int n, m;
	scanf("%d %d", &n, &m);
	for(int i = 1; i <= n; i++) {
		scanf("%s", s[i] + 1);
	}
	for(int i = n; i >= 1; i--) {
		for(int j = 1; j <= m; j++) {
			cnt[i][j] = cnt[i + 1][j] + (s[i][j] == 'I');
		}
	}
	long long ans = 0;
	for(int i = 1; i <= n; i++) {
		int orb = 0;
		for(int j = m; j >= 1; j--) {
			orb += (s[i][j] == 'O');
			if(s[i][j] == 'J') {
				ans += cnt[i][j] * orb;
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main(int, const char**)':
joi2019_ho_t1.cpp:9: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:11:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s", s[i] + 1);
   ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 1024 KB Output is correct
6 Correct 4 ms 1024 KB Output is correct
7 Correct 2 ms 1024 KB Output is correct
8 Correct 4 ms 1024 KB Output is correct
9 Correct 3 ms 1024 KB Output is correct
10 Correct 3 ms 1024 KB Output is correct
11 Correct 3 ms 1024 KB Output is correct
12 Correct 3 ms 1024 KB Output is correct
13 Correct 3 ms 1024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 1024 KB Output is correct
6 Correct 4 ms 1024 KB Output is correct
7 Correct 2 ms 1024 KB Output is correct
8 Correct 4 ms 1024 KB Output is correct
9 Correct 3 ms 1024 KB Output is correct
10 Correct 3 ms 1024 KB Output is correct
11 Correct 3 ms 1024 KB Output is correct
12 Correct 3 ms 1024 KB Output is correct
13 Correct 3 ms 1024 KB Output is correct
14 Correct 7 ms 4608 KB Output is correct
15 Correct 3 ms 3328 KB Output is correct
16 Correct 5 ms 2688 KB Output is correct
17 Correct 0 ms 384 KB Output is correct
18 Correct 13 ms 4736 KB Output is correct
19 Correct 8 ms 4736 KB Output is correct
20 Correct 7 ms 4736 KB Output is correct
21 Correct 9 ms 4728 KB Output is correct
22 Correct 7 ms 4736 KB Output is correct
23 Correct 8 ms 4716 KB Output is correct
24 Correct 14 ms 4736 KB Output is correct
25 Correct 7 ms 4736 KB Output is correct
26 Correct 8 ms 4736 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 1024 KB Output is correct
6 Correct 4 ms 1024 KB Output is correct
7 Correct 2 ms 1024 KB Output is correct
8 Correct 4 ms 1024 KB Output is correct
9 Correct 3 ms 1024 KB Output is correct
10 Correct 3 ms 1024 KB Output is correct
11 Correct 3 ms 1024 KB Output is correct
12 Correct 3 ms 1024 KB Output is correct
13 Correct 3 ms 1024 KB Output is correct
14 Correct 7 ms 4608 KB Output is correct
15 Correct 3 ms 3328 KB Output is correct
16 Correct 5 ms 2688 KB Output is correct
17 Correct 0 ms 384 KB Output is correct
18 Correct 13 ms 4736 KB Output is correct
19 Correct 8 ms 4736 KB Output is correct
20 Correct 7 ms 4736 KB Output is correct
21 Correct 9 ms 4728 KB Output is correct
22 Correct 7 ms 4736 KB Output is correct
23 Correct 8 ms 4716 KB Output is correct
24 Correct 14 ms 4736 KB Output is correct
25 Correct 7 ms 4736 KB Output is correct
26 Correct 8 ms 4736 KB Output is correct
27 Correct 157 ms 44340 KB Output is correct
28 Correct 15 ms 16512 KB Output is correct
29 Correct 8 ms 4096 KB Output is correct
30 Correct 3 ms 512 KB Output is correct
31 Correct 106 ms 36984 KB Output is correct
32 Correct 106 ms 44664 KB Output is correct
33 Correct 94 ms 44336 KB Output is correct
34 Correct 100 ms 43000 KB Output is correct
35 Correct 117 ms 44380 KB Output is correct
36 Correct 102 ms 44280 KB Output is correct
37 Correct 121 ms 44448 KB Output is correct
38 Correct 62 ms 36984 KB Output is correct
39 Correct 68 ms 36856 KB Output is correct