Submission #764230

# Submission time Handle Problem Language Result Execution time Memory
764230 2023-06-23T09:04:35 Z ind1v Bitaro the Brave (JOI19_ho_t1) C++11
100 / 100
303 ms 88504 KB
#include <bits/stdc++.h>
 
using namespace std;

const int N = 3005;

int n, m;
char a[N][N];
int co[N][N], ci[N][N];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      co[i][j] = co[i][j - 1] + (a[i][j] == 'O');
    }
  }
  for (int j = 1; j <= m; j++) {
    for (int i = 1; i <= n; i++) {
      ci[i][j] = ci[i - 1][j] + (a[i][j] == 'I');
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (a[i][j] == 'J') {
        ans += 1LL * (co[i][m] - co[i][j]) * (ci[n][j] - ci[i][j]);
      }
    }
  }
  cout << ans;
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1496 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 1 ms 1484 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1496 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 1 ms 1484 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 6 ms 7508 KB Output is correct
15 Correct 2 ms 4948 KB Output is correct
16 Correct 4 ms 4312 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 7 ms 8020 KB Output is correct
19 Correct 7 ms 7908 KB Output is correct
20 Correct 10 ms 7824 KB Output is correct
21 Correct 10 ms 8020 KB Output is correct
22 Correct 7 ms 7936 KB Output is correct
23 Correct 7 ms 7764 KB Output is correct
24 Correct 11 ms 7972 KB Output is correct
25 Correct 10 ms 7892 KB Output is correct
26 Correct 7 ms 7764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1496 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 1 ms 1484 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 6 ms 7508 KB Output is correct
15 Correct 2 ms 4948 KB Output is correct
16 Correct 4 ms 4312 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 7 ms 8020 KB Output is correct
19 Correct 7 ms 7908 KB Output is correct
20 Correct 10 ms 7824 KB Output is correct
21 Correct 10 ms 8020 KB Output is correct
22 Correct 7 ms 7936 KB Output is correct
23 Correct 7 ms 7764 KB Output is correct
24 Correct 11 ms 7972 KB Output is correct
25 Correct 10 ms 7892 KB Output is correct
26 Correct 7 ms 7764 KB Output is correct
27 Correct 296 ms 88012 KB Output is correct
28 Correct 11 ms 26052 KB Output is correct
29 Correct 11 ms 7748 KB Output is correct
30 Correct 1 ms 596 KB Output is correct
31 Correct 264 ms 72584 KB Output is correct
32 Correct 263 ms 88448 KB Output is correct
33 Correct 275 ms 88112 KB Output is correct
34 Correct 251 ms 84148 KB Output is correct
35 Correct 277 ms 88440 KB Output is correct
36 Correct 276 ms 88264 KB Output is correct
37 Correct 303 ms 88504 KB Output is correct
38 Correct 169 ms 72524 KB Output is correct
39 Correct 238 ms 72188 KB Output is correct