Submission #886276

# Submission time Handle Problem Language Result Execution time Memory
886276 2023-12-11T16:57:24 Z stefanneagu Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
332 ms 18104 KB
#include <bits/stdc++.h>
using namespace std;
const int nmax = 3e3 + 1;
char mat[nmax][nmax];
int O[nmax], I[nmax];
int main() {
  int n, m;
  cin >> n >> m;
  for(int i = 1; i <= n; i ++) {
    for(int j = 1; j <= m; j ++) {
      cin >> mat[i][j];
    }
  }
  long long ans = 0;
  for(int  i = n; i>=1; i--) {
    for(int j=m; j>=1; j--) {
      if(mat[i][j] == 'J') {
        ans += (long long) I[j] * O[i];
        // cout << i << " " << j << ": " << O[i] << " " << I[j] << endl;
      }
      if(mat[i][j] == 'O') {
          O[i] ++;
        }
        if(mat[i][j] == 'I') {
          I[j] ++;
      }
    }
  }
  cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 2652 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2648 KB Output is correct
8 Correct 1 ms 2648 KB Output is correct
9 Correct 1 ms 2652 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
11 Correct 1 ms 2652 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 1 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 2652 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2648 KB Output is correct
8 Correct 1 ms 2648 KB Output is correct
9 Correct 1 ms 2652 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
11 Correct 1 ms 2652 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 1 ms 2652 KB Output is correct
14 Correct 8 ms 2652 KB Output is correct
15 Correct 1 ms 2652 KB Output is correct
16 Correct 5 ms 2652 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 10 ms 2652 KB Output is correct
19 Correct 8 ms 2656 KB Output is correct
20 Correct 8 ms 2652 KB Output is correct
21 Correct 11 ms 2652 KB Output is correct
22 Correct 10 ms 2652 KB Output is correct
23 Correct 8 ms 2652 KB Output is correct
24 Correct 10 ms 2652 KB Output is correct
25 Correct 8 ms 2652 KB Output is correct
26 Correct 8 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 2652 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2648 KB Output is correct
8 Correct 1 ms 2648 KB Output is correct
9 Correct 1 ms 2652 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
11 Correct 1 ms 2652 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 1 ms 2652 KB Output is correct
14 Correct 8 ms 2652 KB Output is correct
15 Correct 1 ms 2652 KB Output is correct
16 Correct 5 ms 2652 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 10 ms 2652 KB Output is correct
19 Correct 8 ms 2656 KB Output is correct
20 Correct 8 ms 2652 KB Output is correct
21 Correct 11 ms 2652 KB Output is correct
22 Correct 10 ms 2652 KB Output is correct
23 Correct 8 ms 2652 KB Output is correct
24 Correct 10 ms 2652 KB Output is correct
25 Correct 8 ms 2652 KB Output is correct
26 Correct 8 ms 2652 KB Output is correct
27 Correct 314 ms 14620 KB Output is correct
28 Correct 2 ms 8796 KB Output is correct
29 Correct 22 ms 3284 KB Output is correct
30 Correct 2 ms 348 KB Output is correct
31 Correct 232 ms 14920 KB Output is correct
32 Correct 289 ms 17856 KB Output is correct
33 Correct 288 ms 18000 KB Output is correct
34 Correct 265 ms 15796 KB Output is correct
35 Correct 290 ms 17748 KB Output is correct
36 Correct 298 ms 17976 KB Output is correct
37 Correct 332 ms 18104 KB Output is correct
38 Correct 208 ms 14900 KB Output is correct
39 Correct 202 ms 14788 KB Output is correct