Submission #883005

# Submission time Handle Problem Language Result Execution time Memory
883005 2023-12-04T11:47:26 Z erray Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
87 ms 89704 KB
// author: erray
#include <bits/stdc++.h>

#ifdef DEBUG
  #include "debug.h"
#else
  #define debug(...) void(37)
#endif

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  for (int i = 0; i < H; ++i) {
    cin >> S[i];
  }
  vector<vector<int>> I(H + 1, vector<int>(W + 1));
  vector<vector<int>> O(H + 1, vector<int>(W + 1));
  long long ans = 0;
  for (int i = H - 1; i >= 0; --i) {
    for (int j = W - 1; j >= 0; --j) {
      I[i][j] = I[i + 1][j] + (S[i][j] == 'I');
      O[i][j] = O[i][j + 1] + (S[i][j] == 'O');
      if (S[i][j] == 'J') {
        ans += 1LL * I[i][j] * O[i][j];
      }
    }
  } 
  cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 500 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 500 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 2 ms 2396 KB Output is correct
15 Correct 0 ms 464 KB Output is correct
16 Correct 1 ms 1628 KB Output is correct
17 Correct 0 ms 452 KB Output is correct
18 Correct 2 ms 2768 KB Output is correct
19 Correct 2 ms 2652 KB Output is correct
20 Correct 2 ms 2908 KB Output is correct
21 Correct 3 ms 2908 KB Output is correct
22 Correct 2 ms 2652 KB Output is correct
23 Correct 2 ms 2808 KB Output is correct
24 Correct 3 ms 2908 KB Output is correct
25 Correct 2 ms 2648 KB Output is correct
26 Correct 2 ms 2904 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 500 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 2 ms 2396 KB Output is correct
15 Correct 0 ms 464 KB Output is correct
16 Correct 1 ms 1628 KB Output is correct
17 Correct 0 ms 452 KB Output is correct
18 Correct 2 ms 2768 KB Output is correct
19 Correct 2 ms 2652 KB Output is correct
20 Correct 2 ms 2908 KB Output is correct
21 Correct 3 ms 2908 KB Output is correct
22 Correct 2 ms 2652 KB Output is correct
23 Correct 2 ms 2808 KB Output is correct
24 Correct 3 ms 2908 KB Output is correct
25 Correct 2 ms 2648 KB Output is correct
26 Correct 2 ms 2904 KB Output is correct
27 Correct 74 ms 84720 KB Output is correct
28 Correct 1 ms 860 KB Output is correct
29 Correct 5 ms 6744 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 61 ms 62564 KB Output is correct
32 Correct 66 ms 88916 KB Output is correct
33 Correct 67 ms 89472 KB Output is correct
34 Correct 69 ms 72208 KB Output is correct
35 Correct 68 ms 89088 KB Output is correct
36 Correct 67 ms 89428 KB Output is correct
37 Correct 87 ms 89704 KB Output is correct
38 Correct 46 ms 61936 KB Output is correct
39 Correct 45 ms 62172 KB Output is correct