Submission #651454

# Submission time Handle Problem Language Result Execution time Memory
651454 2022-10-18T19:43:19 Z pauloamed Bitaro the Brave (JOI19_ho_t1) C++14
50 / 100
85 ms 4776 KB
#include<bits/stdc++.h>
using namespace std;

#define int long long
const int MAXN = 510;

char M[MAXN][MAXN];

int Os[MAXN][MAXN];
int Is[MAXN][MAXN];

int32_t main(){
  int h, w; cin >> h >> w;
  for(int i = 0; i < h; ++i){
    for(int j = 0; j < w; ++j){
      cin >> M[i][j];
    }
  }

  for(int i = 0; i < h; ++i){
    for(int j = w - 1; j >= 0; --j){
      Os[i][j] = (M[i][j] == 'O');
      if(j + 1 < w) Os[i][j] += Os[i][j + 1];
    }
  }

  for(int j = 0; j < w; j++){
    for(int i = h - 1; i >= 0; --i){
      Is[i][j] = (M[i][j] == 'I');
      if(i + 1 < h) Is[i][j] += Is[i + 1][j];
    }
  }

  int ans = 0;
  for(int i = 0; i < h; ++i){
    for(int j = 0; j < w; ++j){
      if(M[i][j] == 'J'){
        int x = Is[i][j] * Os[i][j];
        ans += x;
      }
    }
  }
  cout << ans << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 2 ms 1108 KB Output is correct
6 Correct 2 ms 1108 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 1084 KB Output is correct
9 Correct 1 ms 1080 KB Output is correct
10 Correct 1 ms 1084 KB Output is correct
11 Correct 2 ms 1108 KB Output is correct
12 Correct 2 ms 1108 KB Output is correct
13 Correct 1 ms 980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 2 ms 1108 KB Output is correct
6 Correct 2 ms 1108 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 1084 KB Output is correct
9 Correct 1 ms 1080 KB Output is correct
10 Correct 1 ms 1084 KB Output is correct
11 Correct 2 ms 1108 KB Output is correct
12 Correct 2 ms 1108 KB Output is correct
13 Correct 1 ms 980 KB Output is correct
14 Correct 15 ms 4692 KB Output is correct
15 Correct 3 ms 3796 KB Output is correct
16 Correct 10 ms 2632 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 18 ms 4772 KB Output is correct
19 Correct 18 ms 4752 KB Output is correct
20 Correct 19 ms 4668 KB Output is correct
21 Correct 20 ms 4684 KB Output is correct
22 Correct 17 ms 4692 KB Output is correct
23 Correct 17 ms 4620 KB Output is correct
24 Correct 19 ms 4776 KB Output is correct
25 Correct 17 ms 4744 KB Output is correct
26 Correct 17 ms 4624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 2 ms 1108 KB Output is correct
6 Correct 2 ms 1108 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 1084 KB Output is correct
9 Correct 1 ms 1080 KB Output is correct
10 Correct 1 ms 1084 KB Output is correct
11 Correct 2 ms 1108 KB Output is correct
12 Correct 2 ms 1108 KB Output is correct
13 Correct 1 ms 980 KB Output is correct
14 Correct 15 ms 4692 KB Output is correct
15 Correct 3 ms 3796 KB Output is correct
16 Correct 10 ms 2632 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 18 ms 4772 KB Output is correct
19 Correct 18 ms 4752 KB Output is correct
20 Correct 19 ms 4668 KB Output is correct
21 Correct 20 ms 4684 KB Output is correct
22 Correct 17 ms 4692 KB Output is correct
23 Correct 17 ms 4620 KB Output is correct
24 Correct 19 ms 4776 KB Output is correct
25 Correct 17 ms 4744 KB Output is correct
26 Correct 17 ms 4624 KB Output is correct
27 Runtime error 85 ms 2516 KB Execution killed with signal 11
28 Halted 0 ms 0 KB -