Submission #710754

# Submission time Handle Problem Language Result Execution time Memory
710754 2023-03-15T17:47:04 Z mdub Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
393 ms 55844 KB
#include <bits/stdc++.h>

using namespace std;

int main () {
  int n, m; cin >> n >> m;
  vector<string> grid(n);
  for (int i = 0; i < n; i++) {
    cin >> grid[i];
  }
  
  int count = 0;
  vector<vector<int>> js(n, vector<int>(m, 0));
  for (int y = 0; y < n; y++) {
    count = 0;
    for (int x = m - 1; x >= 0; x--) {
      if (grid[y][x] == 'O') count++;
      if (grid[y][x] == 'J') js[y][x] = count;

    }
  }
  
  long long ans = 0;
  count = 0;
  for (int x = 0; x < m; x++) {
    count = 0;
    for (int y = n-1; y >= 0; y--) {
      if (grid[y][x] == 'I') count++;
      if (grid[y][x] == 'J') ans += js[y][x]*count;
    }
  }
  cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 2 ms 308 KB Output is correct
6 Correct 1 ms 304 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 312 KB Output is correct
13 Correct 1 ms 308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 2 ms 308 KB Output is correct
6 Correct 1 ms 304 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 312 KB Output is correct
13 Correct 1 ms 308 KB Output is correct
14 Correct 8 ms 1492 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 4 ms 1136 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 10 ms 2004 KB Output is correct
19 Correct 8 ms 1748 KB Output is correct
20 Correct 7 ms 1976 KB Output is correct
21 Correct 11 ms 2004 KB Output is correct
22 Correct 7 ms 1748 KB Output is correct
23 Correct 8 ms 2000 KB Output is correct
24 Correct 10 ms 1924 KB Output is correct
25 Correct 7 ms 1748 KB Output is correct
26 Correct 8 ms 2004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 2 ms 308 KB Output is correct
6 Correct 1 ms 304 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 312 KB Output is correct
13 Correct 1 ms 308 KB Output is correct
14 Correct 8 ms 1492 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 4 ms 1136 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 10 ms 2004 KB Output is correct
19 Correct 8 ms 1748 KB Output is correct
20 Correct 7 ms 1976 KB Output is correct
21 Correct 11 ms 2004 KB Output is correct
22 Correct 7 ms 1748 KB Output is correct
23 Correct 8 ms 2000 KB Output is correct
24 Correct 10 ms 1924 KB Output is correct
25 Correct 7 ms 1748 KB Output is correct
26 Correct 8 ms 2004 KB Output is correct
27 Correct 369 ms 53276 KB Output is correct
28 Correct 2 ms 596 KB Output is correct
29 Correct 19 ms 4436 KB Output is correct
30 Correct 2 ms 340 KB Output is correct
31 Correct 257 ms 40460 KB Output is correct
32 Correct 291 ms 55560 KB Output is correct
33 Correct 289 ms 55580 KB Output is correct
34 Correct 301 ms 46852 KB Output is correct
35 Correct 296 ms 55516 KB Output is correct
36 Correct 261 ms 55656 KB Output is correct
37 Correct 393 ms 55844 KB Output is correct
38 Correct 186 ms 40220 KB Output is correct
39 Correct 209 ms 40304 KB Output is correct