Submission #174132

# Submission time Handle Problem Language Result Execution time Memory
174132 2020-01-06T09:45:22 Z AlexLuchianov Bitaro the Brave (JOI19_ho_t1) C++14
50 / 100
1000 ms 87940 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[1 + nmax][1 + nmax];
int ingots[1 + nmax][1 + nmax], orbs[1 + nmax][1 + nmax];

int main()
{
  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;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 13 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 5 ms 1528 KB Output is correct
6 Correct 1 ms 1528 KB Output is correct
7 Correct 4 ms 1400 KB Output is correct
8 Correct 4 ms 1528 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 4 ms 1404 KB Output is correct
11 Correct 4 ms 1528 KB Output is correct
12 Correct 4 ms 1528 KB Output is correct
13 Correct 2 ms 1400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 13 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 5 ms 1528 KB Output is correct
6 Correct 1 ms 1528 KB Output is correct
7 Correct 4 ms 1400 KB Output is correct
8 Correct 4 ms 1528 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 4 ms 1404 KB Output is correct
11 Correct 4 ms 1528 KB Output is correct
12 Correct 4 ms 1528 KB Output is correct
13 Correct 2 ms 1400 KB Output is correct
14 Correct 30 ms 7368 KB Output is correct
15 Correct 6 ms 4984 KB Output is correct
16 Correct 19 ms 4344 KB Output is correct
17 Correct 3 ms 508 KB Output is correct
18 Correct 38 ms 8056 KB Output is correct
19 Correct 37 ms 7928 KB Output is correct
20 Correct 33 ms 7800 KB Output is correct
21 Correct 38 ms 8056 KB Output is correct
22 Correct 34 ms 7928 KB Output is correct
23 Correct 34 ms 7928 KB Output is correct
24 Correct 37 ms 8056 KB Output is correct
25 Correct 34 ms 8056 KB Output is correct
26 Correct 33 ms 7928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 13 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 5 ms 1528 KB Output is correct
6 Correct 1 ms 1528 KB Output is correct
7 Correct 4 ms 1400 KB Output is correct
8 Correct 4 ms 1528 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 4 ms 1404 KB Output is correct
11 Correct 4 ms 1528 KB Output is correct
12 Correct 4 ms 1528 KB Output is correct
13 Correct 2 ms 1400 KB Output is correct
14 Correct 30 ms 7368 KB Output is correct
15 Correct 6 ms 4984 KB Output is correct
16 Correct 19 ms 4344 KB Output is correct
17 Correct 3 ms 508 KB Output is correct
18 Correct 38 ms 8056 KB Output is correct
19 Correct 37 ms 7928 KB Output is correct
20 Correct 33 ms 7800 KB Output is correct
21 Correct 38 ms 8056 KB Output is correct
22 Correct 34 ms 7928 KB Output is correct
23 Correct 34 ms 7928 KB Output is correct
24 Correct 37 ms 8056 KB Output is correct
25 Correct 34 ms 8056 KB Output is correct
26 Correct 33 ms 7928 KB Output is correct
27 Execution timed out 1046 ms 87940 KB Time limit exceeded
28 Halted 0 ms 0 KB -