답안 #651455

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
651455 2022-10-18T19:46:22 Z pauloamed Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
762 ms 159232 KB
#include<bits/stdc++.h>
using namespace std;

#define int long long
const int MAXN = 3010;

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";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 2 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 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 2 ms 1492 KB Output is correct
13 Correct 2 ms 1364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 2 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 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 2 ms 1492 KB Output is correct
13 Correct 2 ms 1364 KB Output is correct
14 Correct 17 ms 8740 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 11 ms 5168 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 20 ms 9684 KB Output is correct
19 Correct 20 ms 9556 KB Output is correct
20 Correct 20 ms 9536 KB Output is correct
21 Correct 22 ms 9624 KB Output is correct
22 Correct 20 ms 9556 KB Output is correct
23 Correct 20 ms 9496 KB Output is correct
24 Correct 22 ms 9684 KB Output is correct
25 Correct 22 ms 9496 KB Output is correct
26 Correct 22 ms 9424 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 2 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 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 2 ms 1492 KB Output is correct
13 Correct 2 ms 1364 KB Output is correct
14 Correct 17 ms 8740 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 11 ms 5168 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 20 ms 9684 KB Output is correct
19 Correct 20 ms 9556 KB Output is correct
20 Correct 20 ms 9536 KB Output is correct
21 Correct 22 ms 9624 KB Output is correct
22 Correct 20 ms 9556 KB Output is correct
23 Correct 20 ms 9496 KB Output is correct
24 Correct 22 ms 9684 KB Output is correct
25 Correct 22 ms 9496 KB Output is correct
26 Correct 22 ms 9424 KB Output is correct
27 Correct 738 ms 157212 KB Output is correct
28 Correct 14 ms 26324 KB Output is correct
29 Correct 46 ms 13852 KB Output is correct
30 Correct 3 ms 736 KB Output is correct
31 Correct 534 ms 131632 KB Output is correct
32 Correct 730 ms 159180 KB Output is correct
33 Correct 726 ms 158752 KB Output is correct
34 Correct 633 ms 152616 KB Output is correct
35 Correct 737 ms 159232 KB Output is correct
36 Correct 726 ms 158812 KB Output is correct
37 Correct 762 ms 159188 KB Output is correct
38 Correct 514 ms 130632 KB Output is correct
39 Correct 520 ms 131008 KB Output is correct