답안 #646870

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
646870 2022-09-30T21:59:51 Z heittpr Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
308 ms 46648 KB
#include <bits/stdc++.h>
using namespace std;
int h, w;
char grid[3010][3010];
int x[3010][3010];

int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin >> h >> w;
  for (int j = 0; j < h; j++)
    for (int i = 0; i < w; i++)
      cin >> grid[i][j];
  for (int j = 0; j < h; j++) {
    int k = 0;
    for (int i = w; i >= 0; i--) {
      // cout << i << ',' << j << ' ' << grid[i][j] << '\n';
      if (grid[i][j] == 'O') k++;
      if (grid[i][j] == 'J') {
        // cout << "-> " << i << ',' << j << ' '  << k << '\n';
        x[i][j] = k;
      }
    }
    // cout << "\n";
  }
  long long ans = 0;
  for (int i = 0; i < w; i++) {
    int k = 0;
    for (int j = 0; j < h; j++) {
      k += x[i][j];
      // cout << i << ',' << j << ' ' << grid[i][j] << ' ' << k << '\n';
      if (grid[i][j] == 'I') {
        ans += k;
        // cout << "-> " << i << ',' << j << ' ' << k << '\n';
      }
    }
    // cout << '\n';
  }
  cout << ans << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 1 ms 852 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 984 KB Output is correct
9 Correct 1 ms 852 KB Output is correct
10 Correct 1 ms 980 KB Output is correct
11 Correct 1 ms 976 KB Output is correct
12 Correct 1 ms 844 KB Output is correct
13 Correct 1 ms 980 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 1 ms 852 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 984 KB Output is correct
9 Correct 1 ms 852 KB Output is correct
10 Correct 1 ms 980 KB Output is correct
11 Correct 1 ms 976 KB Output is correct
12 Correct 1 ms 844 KB Output is correct
13 Correct 1 ms 980 KB Output is correct
14 Correct 7 ms 3796 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 5 ms 4308 KB Output is correct
17 Correct 1 ms 2260 KB Output is correct
18 Correct 13 ms 4920 KB Output is correct
19 Correct 9 ms 4052 KB Output is correct
20 Correct 7 ms 4304 KB Output is correct
21 Correct 11 ms 5012 KB Output is correct
22 Correct 8 ms 4528 KB Output is correct
23 Correct 7 ms 4304 KB Output is correct
24 Correct 11 ms 4992 KB Output is correct
25 Correct 7 ms 4180 KB Output is correct
26 Correct 6 ms 4308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 1 ms 852 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 984 KB Output is correct
9 Correct 1 ms 852 KB Output is correct
10 Correct 1 ms 980 KB Output is correct
11 Correct 1 ms 976 KB Output is correct
12 Correct 1 ms 844 KB Output is correct
13 Correct 1 ms 980 KB Output is correct
14 Correct 7 ms 3796 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 5 ms 4308 KB Output is correct
17 Correct 1 ms 2260 KB Output is correct
18 Correct 13 ms 4920 KB Output is correct
19 Correct 9 ms 4052 KB Output is correct
20 Correct 7 ms 4304 KB Output is correct
21 Correct 11 ms 5012 KB Output is correct
22 Correct 8 ms 4528 KB Output is correct
23 Correct 7 ms 4304 KB Output is correct
24 Correct 11 ms 4992 KB Output is correct
25 Correct 7 ms 4180 KB Output is correct
26 Correct 6 ms 4308 KB Output is correct
27 Correct 308 ms 44160 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 39 ms 20728 KB Output is correct
30 Correct 8 ms 16212 KB Output is correct
31 Correct 244 ms 39296 KB Output is correct
32 Correct 205 ms 39156 KB Output is correct
33 Correct 216 ms 34984 KB Output is correct
34 Correct 273 ms 39304 KB Output is correct
35 Correct 232 ms 41092 KB Output is correct
36 Correct 245 ms 34996 KB Output is correct
37 Correct 299 ms 46648 KB Output is correct
38 Correct 148 ms 31980 KB Output is correct
39 Correct 148 ms 27992 KB Output is correct