답안 #225482

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
225482 2020-04-20T15:47:43 Z Nightlight Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
272 ms 81016 KB
#include <bits/stdc++.h>
using namespace std;

int H, W;
bitset<3005> grid[3005];
int Osum[3005][3005], Isum[3005][3005];
char tp;
long long ans;

int main() {
//  freopen("inp", "r", stdin);
  scanf("%d %d", &H, &W);
  for(int i = 1; i <= H; i++) {
    getchar();
    for(int j = 1; j <= W; j++) {
      tp = getchar();
      if(tp == 'J') grid[i][j] = 1;
      else if(tp == 'O') Osum[i][j] = 1;
      else Isum[i][j] = 1;
      Osum[i][j] += Osum[i][j - 1];
      Isum[i][j] += Isum[i - 1][j];
    }
  }
  for(int i = 1; i <= H; i++) {
    for(int j = 1; j <= W; j++) {
      if(grid[i][j]) {
        ans += (Osum[i][W] - Osum[i][j]) * (Isum[H][j] - Isum[i][j]);
      }
    }
  }
  printf("%lld\n", ans);
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &H, &W);
   ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 1280 KB Output is correct
6 Correct 6 ms 1280 KB Output is correct
7 Correct 5 ms 1152 KB Output is correct
8 Correct 6 ms 1280 KB Output is correct
9 Correct 6 ms 1332 KB Output is correct
10 Correct 6 ms 1152 KB Output is correct
11 Correct 6 ms 1280 KB Output is correct
12 Correct 5 ms 1280 KB Output is correct
13 Correct 6 ms 1152 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 1280 KB Output is correct
6 Correct 6 ms 1280 KB Output is correct
7 Correct 5 ms 1152 KB Output is correct
8 Correct 6 ms 1280 KB Output is correct
9 Correct 6 ms 1332 KB Output is correct
10 Correct 6 ms 1152 KB Output is correct
11 Correct 6 ms 1280 KB Output is correct
12 Correct 5 ms 1280 KB Output is correct
13 Correct 6 ms 1152 KB Output is correct
14 Correct 12 ms 6272 KB Output is correct
15 Correct 7 ms 3840 KB Output is correct
16 Correct 9 ms 3712 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 18 ms 6784 KB Output is correct
19 Correct 12 ms 6656 KB Output is correct
20 Correct 12 ms 6656 KB Output is correct
21 Correct 15 ms 6784 KB Output is correct
22 Correct 12 ms 6656 KB Output is correct
23 Correct 12 ms 6528 KB Output is correct
24 Correct 14 ms 6784 KB Output is correct
25 Correct 15 ms 6656 KB Output is correct
26 Correct 13 ms 6656 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 1280 KB Output is correct
6 Correct 6 ms 1280 KB Output is correct
7 Correct 5 ms 1152 KB Output is correct
8 Correct 6 ms 1280 KB Output is correct
9 Correct 6 ms 1332 KB Output is correct
10 Correct 6 ms 1152 KB Output is correct
11 Correct 6 ms 1280 KB Output is correct
12 Correct 5 ms 1280 KB Output is correct
13 Correct 6 ms 1152 KB Output is correct
14 Correct 12 ms 6272 KB Output is correct
15 Correct 7 ms 3840 KB Output is correct
16 Correct 9 ms 3712 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 18 ms 6784 KB Output is correct
19 Correct 12 ms 6656 KB Output is correct
20 Correct 12 ms 6656 KB Output is correct
21 Correct 15 ms 6784 KB Output is correct
22 Correct 12 ms 6656 KB Output is correct
23 Correct 12 ms 6528 KB Output is correct
24 Correct 14 ms 6784 KB Output is correct
25 Correct 15 ms 6656 KB Output is correct
26 Correct 13 ms 6656 KB Output is correct
27 Correct 253 ms 80368 KB Output is correct
28 Correct 17 ms 19968 KB Output is correct
29 Correct 19 ms 7168 KB Output is correct
30 Correct 5 ms 640 KB Output is correct
31 Correct 189 ms 66296 KB Output is correct
32 Correct 208 ms 80760 KB Output is correct
33 Correct 191 ms 80504 KB Output is correct
34 Correct 215 ms 76664 KB Output is correct
35 Correct 209 ms 80888 KB Output is correct
36 Correct 187 ms 80504 KB Output is correct
37 Correct 272 ms 81016 KB Output is correct
38 Correct 144 ms 66168 KB Output is correct
39 Correct 144 ms 65912 KB Output is correct