Submission #654668

# Submission time Handle Problem Language Result Execution time Memory
654668 2022-11-01T07:25:32 Z lunchbox1 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
103 ms 89460 KB
/*
 Bitaro the Brave
 https://oj.uz/problem/view/JOI19_ho_t1
*/
#include <bits/stdc++.h>
using namespace std;

const int N = 3000;

int main() {
 ios::sync_with_stdio(0), cin.tie(0);
 int n, m; cin >> n >> m;
 static string s[N];
 for (int i = 0; i < n; i++) cin >> s[i];
 static int co[N][N], ci[N][N];
 long long ans = 0;
 for (int i = n - 1; i >= 0; i--)
  for (int j = m - 1; j >= 0; j--) {
   if (j < m - 1) co[i][j] += co[i][j + 1];
   if (i < n - 1) ci[i][j] += ci[i + 1][j];
   if (s[i][j] == 'J') ans += co[i][j] * ci[i][j];
   else if (s[i][j] == 'O') co[i][j]++;
   else ci[i][j]++;
  }
 cout << ans << '\n';
 return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 1232 KB Output is correct
6 Correct 1 ms 1236 KB Output is correct
7 Correct 1 ms 1116 KB Output is correct
8 Correct 1 ms 1236 KB Output is correct
9 Correct 1 ms 1232 KB Output is correct
10 Correct 1 ms 1108 KB Output is correct
11 Correct 1 ms 1236 KB Output is correct
12 Correct 1 ms 1236 KB Output is correct
13 Correct 1 ms 1108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 1232 KB Output is correct
6 Correct 1 ms 1236 KB Output is correct
7 Correct 1 ms 1116 KB Output is correct
8 Correct 1 ms 1236 KB Output is correct
9 Correct 1 ms 1232 KB Output is correct
10 Correct 1 ms 1108 KB Output is correct
11 Correct 1 ms 1236 KB Output is correct
12 Correct 1 ms 1236 KB Output is correct
13 Correct 1 ms 1108 KB Output is correct
14 Correct 4 ms 6228 KB Output is correct
15 Correct 2 ms 3784 KB Output is correct
16 Correct 3 ms 3732 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 5 ms 6792 KB Output is correct
19 Correct 4 ms 6684 KB Output is correct
20 Correct 4 ms 6612 KB Output is correct
21 Correct 5 ms 6872 KB Output is correct
22 Correct 4 ms 6744 KB Output is correct
23 Correct 4 ms 6612 KB Output is correct
24 Correct 5 ms 6796 KB Output is correct
25 Correct 4 ms 6688 KB Output is correct
26 Correct 4 ms 6616 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 1232 KB Output is correct
6 Correct 1 ms 1236 KB Output is correct
7 Correct 1 ms 1116 KB Output is correct
8 Correct 1 ms 1236 KB Output is correct
9 Correct 1 ms 1232 KB Output is correct
10 Correct 1 ms 1108 KB Output is correct
11 Correct 1 ms 1236 KB Output is correct
12 Correct 1 ms 1236 KB Output is correct
13 Correct 1 ms 1108 KB Output is correct
14 Correct 4 ms 6228 KB Output is correct
15 Correct 2 ms 3784 KB Output is correct
16 Correct 3 ms 3732 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 5 ms 6792 KB Output is correct
19 Correct 4 ms 6684 KB Output is correct
20 Correct 4 ms 6612 KB Output is correct
21 Correct 5 ms 6872 KB Output is correct
22 Correct 4 ms 6744 KB Output is correct
23 Correct 4 ms 6612 KB Output is correct
24 Correct 5 ms 6796 KB Output is correct
25 Correct 4 ms 6688 KB Output is correct
26 Correct 4 ms 6616 KB Output is correct
27 Correct 103 ms 88184 KB Output is correct
28 Correct 9 ms 19156 KB Output is correct
29 Correct 6 ms 7764 KB Output is correct
30 Correct 1 ms 596 KB Output is correct
31 Correct 78 ms 71824 KB Output is correct
32 Correct 76 ms 89264 KB Output is correct
33 Correct 72 ms 89032 KB Output is correct
34 Correct 94 ms 83252 KB Output is correct
35 Correct 70 ms 89152 KB Output is correct
36 Correct 73 ms 89036 KB Output is correct
37 Correct 103 ms 89460 KB Output is correct
38 Correct 58 ms 71716 KB Output is correct
39 Correct 52 ms 71500 KB Output is correct