답안 #747503

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
747503 2023-05-24T08:36:22 Z tch1cherin Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
167 ms 89548 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N, M;
  cin >> N >> M;
  vector<string> S(N);
  for (auto &v : S) {
    cin >> v;
  }
  vector row(N, vector<int>(M + 1)), col(M, vector<int>(N + 1));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      row[i][j + 1] = row[i][j] + int(S[i][j] == 'O');
    }
  }
  for (int i = 0; i < M; i++) {
    for (int j = 0; j < N; j++) {
      col[i][j + 1] = col[i][j] + int(S[j][i] == 'I');
    }
  }
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      if (S[i][j] == 'J') {
        ans += (row[i][M] - row[i][j]) * (col[j][N] - col[j][i]);
      }
    }
  }
  cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 324 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 352 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 328 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 324 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 352 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 328 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 3 ms 2132 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 2 ms 1620 KB Output is correct
17 Correct 1 ms 320 KB Output is correct
18 Correct 4 ms 2772 KB Output is correct
19 Correct 3 ms 2724 KB Output is correct
20 Correct 3 ms 2772 KB Output is correct
21 Correct 4 ms 2764 KB Output is correct
22 Correct 3 ms 2644 KB Output is correct
23 Correct 3 ms 2772 KB Output is correct
24 Correct 4 ms 2760 KB Output is correct
25 Correct 3 ms 2628 KB Output is correct
26 Correct 3 ms 2772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 324 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 352 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 328 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 3 ms 2132 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 2 ms 1620 KB Output is correct
17 Correct 1 ms 320 KB Output is correct
18 Correct 4 ms 2772 KB Output is correct
19 Correct 3 ms 2724 KB Output is correct
20 Correct 3 ms 2772 KB Output is correct
21 Correct 4 ms 2764 KB Output is correct
22 Correct 3 ms 2644 KB Output is correct
23 Correct 3 ms 2772 KB Output is correct
24 Correct 4 ms 2760 KB Output is correct
25 Correct 3 ms 2628 KB Output is correct
26 Correct 3 ms 2772 KB Output is correct
27 Correct 143 ms 84584 KB Output is correct
28 Correct 1 ms 724 KB Output is correct
29 Correct 8 ms 6740 KB Output is correct
30 Correct 1 ms 584 KB Output is correct
31 Correct 103 ms 62260 KB Output is correct
32 Correct 123 ms 89076 KB Output is correct
33 Correct 149 ms 89296 KB Output is correct
34 Correct 120 ms 72136 KB Output is correct
35 Correct 146 ms 89056 KB Output is correct
36 Correct 137 ms 89336 KB Output is correct
37 Correct 167 ms 89548 KB Output is correct
38 Correct 72 ms 61792 KB Output is correct
39 Correct 82 ms 62040 KB Output is correct