Submission #518412

# Submission time Handle Problem Language Result Execution time Memory
518412 2022-01-23T17:40:25 Z Alex_tz307 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
63 ms 27752 KB
#include <bits/stdc++.h>

using namespace std;

void testCase() {
  int n, m;
  cin >> n >> m;
  vector<string> a(n);
  for (auto &s : a) {
    cin >> s;
  }
  vector<vector<short>> ingot(n + 1, vector<short>(m + 1));
  int64_t ans = 0;
  for (int i = n - 1; i >= 0; --i) {
    int orb = 0;
    for (int j = m - 1; j >= 0; --j) {
      if (a[i][j] == 'J') {
        ans += (int64_t)ingot[i + 1][j] * orb;
      }
      ingot[i][j] = ingot[i + 1][j] + (a[i][j] == 'I');
      orb += (a[i][j] == 'O');
    }
  }
  cout << ans << '\n';
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int tests = 1;
  for (int tc = 0; tc < tests; ++tc) {
    testCase();
  }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 232 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 0 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 0 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 0 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 232 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 0 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 0 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 0 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 2 ms 844 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 716 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 2 ms 1100 KB Output is correct
19 Correct 2 ms 972 KB Output is correct
20 Correct 2 ms 972 KB Output is correct
21 Correct 3 ms 1100 KB Output is correct
22 Correct 1 ms 972 KB Output is correct
23 Correct 1 ms 972 KB Output is correct
24 Correct 2 ms 1100 KB Output is correct
25 Correct 1 ms 972 KB Output is correct
26 Correct 2 ms 972 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 232 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 0 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 0 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 0 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 2 ms 844 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 716 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 2 ms 1100 KB Output is correct
19 Correct 2 ms 972 KB Output is correct
20 Correct 2 ms 972 KB Output is correct
21 Correct 3 ms 1100 KB Output is correct
22 Correct 1 ms 972 KB Output is correct
23 Correct 1 ms 972 KB Output is correct
24 Correct 2 ms 1100 KB Output is correct
25 Correct 1 ms 972 KB Output is correct
26 Correct 2 ms 972 KB Output is correct
27 Correct 54 ms 26244 KB Output is correct
28 Correct 1 ms 460 KB Output is correct
29 Correct 3 ms 2252 KB Output is correct
30 Correct 1 ms 332 KB Output is correct
31 Correct 43 ms 19276 KB Output is correct
32 Correct 37 ms 27580 KB Output is correct
33 Correct 34 ms 27716 KB Output is correct
34 Correct 48 ms 22340 KB Output is correct
35 Correct 46 ms 27624 KB Output is correct
36 Correct 35 ms 27732 KB Output is correct
37 Correct 63 ms 27752 KB Output is correct
38 Correct 29 ms 19148 KB Output is correct
39 Correct 23 ms 19272 KB Output is correct