답안 #465074

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
465074 2021-08-15T07:07:40 Z Halit Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
772 ms 150340 KB
// author: Halit
#include <bits/stdc++.h>

int main() {
  int n, m;
  std::cin >> n >> m;

  std::vector<std::vector<char>> a(n, std::vector<char>(m));
  std::vector<std::vector<int64_t>> count_orbs(n+1, std::vector<int64_t>(m+1));
  std::vector<std::vector<int64_t>> count_ingots(n+1, std::vector<int64_t>(m+1));

  for (int i = 0;i < n; ++i) {
    for (int j = 0;j < m; ++j) {
      std::cin >> a[i][j];
      count_orbs[i][j] += (a[i][j] == 'O');
      count_ingots[i][j] += (a[i][j] == 'I');
    }
  }

  for (int i = 0;i < n; ++i) for (int j = m-1;j >= 0; --j) count_orbs[i][j] += count_orbs[i][j+1];
  for (int i = n-1;i >= 0; --i) for (int j = 0;j < m; ++j) count_ingots[i][j] += count_ingots[i+1][j];

  int64_t ans = 0;
  for (int i = 0;i < n; ++i) {
    for (int j = 0;j < m; ++j) {
      ans += (a[i][j] == 'J') * (count_orbs[i][j+1]) * (count_ingots[i+1][j]);
    }
  }

  std::cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 2 ms 460 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 452 KB Output is correct
8 Correct 1 ms 460 KB Output is correct
9 Correct 1 ms 360 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 2 ms 460 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 452 KB Output is correct
8 Correct 1 ms 460 KB Output is correct
9 Correct 1 ms 360 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 18 ms 3548 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 11 ms 2488 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 21 ms 4520 KB Output is correct
19 Correct 21 ms 4352 KB Output is correct
20 Correct 21 ms 4436 KB Output is correct
21 Correct 22 ms 4428 KB Output is correct
22 Correct 20 ms 4300 KB Output is correct
23 Correct 24 ms 4428 KB Output is correct
24 Correct 21 ms 4512 KB Output is correct
25 Correct 22 ms 4428 KB Output is correct
26 Correct 22 ms 4428 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 2 ms 460 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 452 KB Output is correct
8 Correct 1 ms 460 KB Output is correct
9 Correct 1 ms 360 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 18 ms 3548 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 11 ms 2488 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 21 ms 4520 KB Output is correct
19 Correct 21 ms 4352 KB Output is correct
20 Correct 21 ms 4436 KB Output is correct
21 Correct 22 ms 4428 KB Output is correct
22 Correct 20 ms 4300 KB Output is correct
23 Correct 24 ms 4428 KB Output is correct
24 Correct 21 ms 4512 KB Output is correct
25 Correct 22 ms 4428 KB Output is correct
26 Correct 22 ms 4428 KB Output is correct
27 Correct 696 ms 142100 KB Output is correct
28 Correct 3 ms 972 KB Output is correct
29 Correct 54 ms 11084 KB Output is correct
30 Correct 2 ms 716 KB Output is correct
31 Correct 509 ms 104572 KB Output is correct
32 Correct 752 ms 149388 KB Output is correct
33 Correct 772 ms 149828 KB Output is correct
34 Correct 594 ms 121260 KB Output is correct
35 Correct 721 ms 149292 KB Output is correct
36 Correct 729 ms 149876 KB Output is correct
37 Correct 763 ms 150340 KB Output is correct
38 Correct 513 ms 103748 KB Output is correct
39 Correct 515 ms 104260 KB Output is correct