Submission #603270

# Submission time Handle Problem Language Result Execution time Memory
603270 2022-07-23T20:05:11 Z IvanJ Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
61 ms 17956 KB
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

const int maxn = 3005;

int n, m;
char mat[maxn][maxn];
int O[maxn], I[maxn];

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

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]
   14 |  scanf("%d%d", &n, &m);
      |  ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:15:32: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |  for(int i = 0;i < n;i++) scanf("%s", mat[i]);
      |                           ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 312 KB Output is correct
5 Correct 1 ms 596 KB Output is correct
6 Correct 1 ms 596 KB Output is correct
7 Correct 1 ms 576 KB Output is correct
8 Correct 1 ms 596 KB Output is correct
9 Correct 1 ms 596 KB Output is correct
10 Correct 1 ms 572 KB Output is correct
11 Correct 1 ms 596 KB Output is correct
12 Correct 1 ms 596 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 312 KB Output is correct
5 Correct 1 ms 596 KB Output is correct
6 Correct 1 ms 596 KB Output is correct
7 Correct 1 ms 576 KB Output is correct
8 Correct 1 ms 596 KB Output is correct
9 Correct 1 ms 596 KB Output is correct
10 Correct 1 ms 572 KB Output is correct
11 Correct 1 ms 596 KB Output is correct
12 Correct 1 ms 596 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
14 Correct 2 ms 1876 KB Output is correct
15 Correct 1 ms 1468 KB Output is correct
16 Correct 2 ms 1108 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 3 ms 2004 KB Output is correct
19 Correct 3 ms 2004 KB Output is correct
20 Correct 2 ms 1968 KB Output is correct
21 Correct 3 ms 2004 KB Output is correct
22 Correct 3 ms 1984 KB Output is correct
23 Correct 2 ms 1988 KB Output is correct
24 Correct 3 ms 1984 KB Output is correct
25 Correct 3 ms 2004 KB Output is correct
26 Correct 3 ms 1876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 312 KB Output is correct
5 Correct 1 ms 596 KB Output is correct
6 Correct 1 ms 596 KB Output is correct
7 Correct 1 ms 576 KB Output is correct
8 Correct 1 ms 596 KB Output is correct
9 Correct 1 ms 596 KB Output is correct
10 Correct 1 ms 572 KB Output is correct
11 Correct 1 ms 596 KB Output is correct
12 Correct 1 ms 596 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
14 Correct 2 ms 1876 KB Output is correct
15 Correct 1 ms 1468 KB Output is correct
16 Correct 2 ms 1108 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 3 ms 2004 KB Output is correct
19 Correct 3 ms 2004 KB Output is correct
20 Correct 2 ms 1968 KB Output is correct
21 Correct 3 ms 2004 KB Output is correct
22 Correct 3 ms 1984 KB Output is correct
23 Correct 2 ms 1988 KB Output is correct
24 Correct 3 ms 1984 KB Output is correct
25 Correct 3 ms 2004 KB Output is correct
26 Correct 3 ms 1876 KB Output is correct
27 Correct 55 ms 17580 KB Output is correct
28 Correct 3 ms 7124 KB Output is correct
29 Correct 5 ms 1696 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 39 ms 13664 KB Output is correct
32 Correct 52 ms 17868 KB Output is correct
33 Correct 55 ms 17836 KB Output is correct
34 Correct 47 ms 15908 KB Output is correct
35 Correct 53 ms 17956 KB Output is correct
36 Correct 54 ms 17800 KB Output is correct
37 Correct 61 ms 17928 KB Output is correct
38 Correct 39 ms 13720 KB Output is correct
39 Correct 38 ms 13672 KB Output is correct