답안 #174138

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
174138 2020-01-06T09:47:01 Z AlexLuchianov Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
401 ms 88584 KB
#include <iostream>

using namespace std;

using ll = long long;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

int const nmax = 3000;
char v[5 + nmax][5 + nmax];
int ingots[5 + nmax][5 + nmax], orbs[5 + nmax][5 + nmax];

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  int n, m;
  cin >> n >> m;
  for(int i = 1;i <= n; i++)
    for(int j = 1;j <= m; j++) {
      cin >> v[i][j];
      if(v[i][j] == 'O')
        orbs[i][j]++;
      else if(v[i][j] == 'I')
        ingots[i][j]++;
    }

  for(int i = n; 1 <= i; i--)
    for(int j = m; 1 <= j; j--) {
      orbs[i][j] += orbs[i][j + 1];
      ingots[i][j] += ingots[i + 1][j];
    }

  ll result = 0;
  for(int i = 1;i <= n; i++)
    for(int j = 1;j <= m; j++)
      if(v[i][j] == 'J') {
        result += orbs[i][j] * ingots[i][j];
      }
  cout << result << '\n';
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 0 ms 376 KB Output is correct
5 Correct 3 ms 1528 KB Output is correct
6 Correct 3 ms 1528 KB Output is correct
7 Correct 3 ms 1400 KB Output is correct
8 Correct 3 ms 1528 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 3 ms 1400 KB Output is correct
11 Correct 3 ms 1528 KB Output is correct
12 Correct 3 ms 1528 KB Output is correct
13 Correct 3 ms 1400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 0 ms 376 KB Output is correct
5 Correct 3 ms 1528 KB Output is correct
6 Correct 3 ms 1528 KB Output is correct
7 Correct 3 ms 1400 KB Output is correct
8 Correct 3 ms 1528 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 3 ms 1400 KB Output is correct
11 Correct 3 ms 1528 KB Output is correct
12 Correct 3 ms 1528 KB Output is correct
13 Correct 3 ms 1400 KB Output is correct
14 Correct 14 ms 7288 KB Output is correct
15 Correct 9 ms 4984 KB Output is correct
16 Correct 8 ms 4216 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 16 ms 7800 KB Output is correct
19 Correct 13 ms 7672 KB Output is correct
20 Correct 12 ms 7596 KB Output is correct
21 Correct 15 ms 7800 KB Output is correct
22 Correct 17 ms 7672 KB Output is correct
23 Correct 13 ms 7672 KB Output is correct
24 Correct 17 ms 7800 KB Output is correct
25 Correct 13 ms 7672 KB Output is correct
26 Correct 12 ms 7672 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 0 ms 376 KB Output is correct
5 Correct 3 ms 1528 KB Output is correct
6 Correct 3 ms 1528 KB Output is correct
7 Correct 3 ms 1400 KB Output is correct
8 Correct 3 ms 1528 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 3 ms 1400 KB Output is correct
11 Correct 3 ms 1528 KB Output is correct
12 Correct 3 ms 1528 KB Output is correct
13 Correct 3 ms 1400 KB Output is correct
14 Correct 14 ms 7288 KB Output is correct
15 Correct 9 ms 4984 KB Output is correct
16 Correct 8 ms 4216 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 16 ms 7800 KB Output is correct
19 Correct 13 ms 7672 KB Output is correct
20 Correct 12 ms 7596 KB Output is correct
21 Correct 15 ms 7800 KB Output is correct
22 Correct 17 ms 7672 KB Output is correct
23 Correct 13 ms 7672 KB Output is correct
24 Correct 17 ms 7800 KB Output is correct
25 Correct 13 ms 7672 KB Output is correct
26 Correct 12 ms 7672 KB Output is correct
27 Correct 359 ms 79736 KB Output is correct
28 Correct 23 ms 26104 KB Output is correct
29 Correct 21 ms 7800 KB Output is correct
30 Correct 3 ms 680 KB Output is correct
31 Correct 274 ms 72596 KB Output is correct
32 Correct 271 ms 88504 KB Output is correct
33 Correct 240 ms 88312 KB Output is correct
34 Correct 316 ms 84344 KB Output is correct
35 Correct 273 ms 88440 KB Output is correct
36 Correct 235 ms 88312 KB Output is correct
37 Correct 401 ms 88584 KB Output is correct
38 Correct 190 ms 72576 KB Output is correct
39 Correct 175 ms 72284 KB Output is correct