# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
160524 | 2019-10-28T09:31:24 Z | dantoh000 | Bitaro the Brave (JOI19_ho_t1) | C++14 | 904 ms | 158840 KB |
#include <bits/stdc++.h> #define int long long using namespace std; main(){ int n,m; scanf("%lld%lld",&n,&m); char grid[n][m]; for (int i = 0; i < n; i++){ for (int j = 0; j < m; j++){ scanf(" %c",&grid[i][j]); } } int ct1[n][m]; for (int j = 0; j < m; j++){ ct1[n-1][j] = (grid[n-1][j]=='I'); for (int i = n-2; i >= 0; i--){ ct1[i][j] = ct1[i+1][j] + (grid[i][j]=='I'); } } int ct2[n][m]; for (int i = 0; i < n; i++){ ct2[i][m-1] = (grid[i][m-1]=='O'); for (int j = m-2; j >= 0; j--){ ct2[i][j] = ct2[i][j+1] + (grid[i][j]=='O'); } } int ans = 0; for (int i = 0; i < n; i++){ for (int j = 0; j < m; j++){ if (grid[i][j] == 'J') { ans += ct1[i][j]*ct2[i][j]; } } } printf("%lld ",ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 3 ms | 504 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 504 KB | Output is correct |
8 | Correct | 3 ms | 504 KB | Output is correct |
9 | Correct | 3 ms | 504 KB | Output is correct |
10 | Correct | 3 ms | 504 KB | Output is correct |
11 | Correct | 3 ms | 504 KB | Output is correct |
12 | Correct | 2 ms | 504 KB | Output is correct |
13 | Correct | 3 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 3 ms | 504 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 504 KB | Output is correct |
8 | Correct | 3 ms | 504 KB | Output is correct |
9 | Correct | 3 ms | 504 KB | Output is correct |
10 | Correct | 3 ms | 504 KB | Output is correct |
11 | Correct | 3 ms | 504 KB | Output is correct |
12 | Correct | 2 ms | 504 KB | Output is correct |
13 | Correct | 3 ms | 504 KB | Output is correct |
14 | Correct | 17 ms | 3576 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 12 ms | 2424 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 22 ms | 4472 KB | Output is correct |
19 | Correct | 19 ms | 4348 KB | Output is correct |
20 | Correct | 20 ms | 4344 KB | Output is correct |
21 | Correct | 23 ms | 4728 KB | Output is correct |
22 | Correct | 20 ms | 4600 KB | Output is correct |
23 | Correct | 21 ms | 4600 KB | Output is correct |
24 | Correct | 22 ms | 4728 KB | Output is correct |
25 | Correct | 19 ms | 4472 KB | Output is correct |
26 | Correct | 20 ms | 4604 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 3 ms | 504 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 504 KB | Output is correct |
8 | Correct | 3 ms | 504 KB | Output is correct |
9 | Correct | 3 ms | 504 KB | Output is correct |
10 | Correct | 3 ms | 504 KB | Output is correct |
11 | Correct | 3 ms | 504 KB | Output is correct |
12 | Correct | 2 ms | 504 KB | Output is correct |
13 | Correct | 3 ms | 504 KB | Output is correct |
14 | Correct | 17 ms | 3576 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 12 ms | 2424 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 22 ms | 4472 KB | Output is correct |
19 | Correct | 19 ms | 4348 KB | Output is correct |
20 | Correct | 20 ms | 4344 KB | Output is correct |
21 | Correct | 23 ms | 4728 KB | Output is correct |
22 | Correct | 20 ms | 4600 KB | Output is correct |
23 | Correct | 21 ms | 4600 KB | Output is correct |
24 | Correct | 22 ms | 4728 KB | Output is correct |
25 | Correct | 19 ms | 4472 KB | Output is correct |
26 | Correct | 20 ms | 4604 KB | Output is correct |
27 | Correct | 845 ms | 150288 KB | Output is correct |
28 | Correct | 4 ms | 760 KB | Output is correct |
29 | Correct | 51 ms | 11772 KB | Output is correct |
30 | Correct | 4 ms | 836 KB | Output is correct |
31 | Correct | 727 ms | 110584 KB | Output is correct |
32 | Correct | 868 ms | 157900 KB | Output is correct |
33 | Correct | 858 ms | 158344 KB | Output is correct |
34 | Correct | 714 ms | 128092 KB | Output is correct |
35 | Correct | 859 ms | 157944 KB | Output is correct |
36 | Correct | 855 ms | 158328 KB | Output is correct |
37 | Correct | 904 ms | 158840 KB | Output is correct |
38 | Correct | 573 ms | 109616 KB | Output is correct |
39 | Correct | 580 ms | 110116 KB | Output is correct |