# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
139594 | 2019-08-01T06:58:02 Z | math0_0 | Bitaro the Brave (JOI19_ho_t1) | C++11 | 750 ms | 115372 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pi; int main(){ int h, w; cin >> h >> w; string arr[h]; for(int one = 0; one < h; one++){ cin >> arr[one]; } int sufO[h][w] = {0}, sufI[h][w] = {0}; vector<pi> jpos; for(int one = h-1; one >= 0; --one){ for(int two = w-1; two >= 0; --two){ sufO[one][two] = 0; sufI[one][two] = 0; if(arr[one][two] == 'J'){ jpos.push_back(make_pair(one, two)); if(two != w-1){sufO[one][two] = sufO[one][two+1];} if(one != h-1){sufI[one][two] = sufI[one+1][two];} } else if(arr[one][two] == 'O'){ if(two == w-1){sufO[one][two] = 1;} else{sufO[one][two] = sufO[one][two+1] + 1;} if(one != h-1){sufI[one][two] = sufI[one+1][two];} }else{ if(one == h-1){sufI[one][two] = 1;} else{sufI[one][two] = sufI[one+1][two] + 1;} if(two != w-1){sufO[one][two] = sufO[one][two+1];} } } } ll ans = 0; for(int one = 0; one < jpos.size(); one++){ ll x = jpos[one].first; ll y = jpos[one].second; ll pwr = sufO[x][y+1]*sufI[x+1][y]; if(x==h-1 || y==w-1){pwr = 0;} ans+=pwr; } cout << ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 256 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 | 508 KB | Output is correct |
9 | Correct | 3 ms | 404 KB | Output is correct |
10 | Correct | 3 ms | 504 KB | Output is correct |
11 | Correct | 3 ms | 504 KB | Output is correct |
12 | Correct | 3 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 | 256 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 256 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 | 508 KB | Output is correct |
9 | Correct | 3 ms | 404 KB | Output is correct |
10 | Correct | 3 ms | 504 KB | Output is correct |
11 | Correct | 3 ms | 504 KB | Output is correct |
12 | Correct | 3 ms | 504 KB | Output is correct |
13 | Correct | 3 ms | 504 KB | Output is correct |
14 | Correct | 18 ms | 2808 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 | 23 ms | 4084 KB | Output is correct |
19 | Correct | 19 ms | 2936 KB | Output is correct |
20 | Correct | 21 ms | 3956 KB | Output is correct |
21 | Correct | 23 ms | 4084 KB | Output is correct |
22 | Correct | 21 ms | 3796 KB | Output is correct |
23 | Correct | 23 ms | 4084 KB | Output is correct |
24 | Correct | 23 ms | 4088 KB | Output is correct |
25 | Correct | 19 ms | 2936 KB | Output is correct |
26 | Correct | 21 ms | 3956 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 256 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 | 508 KB | Output is correct |
9 | Correct | 3 ms | 404 KB | Output is correct |
10 | Correct | 3 ms | 504 KB | Output is correct |
11 | Correct | 3 ms | 504 KB | Output is correct |
12 | Correct | 3 ms | 504 KB | Output is correct |
13 | Correct | 3 ms | 504 KB | Output is correct |
14 | Correct | 18 ms | 2808 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 | 23 ms | 4084 KB | Output is correct |
19 | Correct | 19 ms | 2936 KB | Output is correct |
20 | Correct | 21 ms | 3956 KB | Output is correct |
21 | Correct | 23 ms | 4084 KB | Output is correct |
22 | Correct | 21 ms | 3796 KB | Output is correct |
23 | Correct | 23 ms | 4084 KB | Output is correct |
24 | Correct | 23 ms | 4088 KB | Output is correct |
25 | Correct | 19 ms | 2936 KB | Output is correct |
26 | Correct | 21 ms | 3956 KB | Output is correct |
27 | Correct | 697 ms | 111224 KB | Output is correct |
28 | Correct | 5 ms | 760 KB | Output is correct |
29 | Correct | 55 ms | 8552 KB | Output is correct |
30 | Correct | 4 ms | 676 KB | Output is correct |
31 | Correct | 509 ms | 75248 KB | Output is correct |
32 | Correct | 632 ms | 90180 KB | Output is correct |
33 | Correct | 682 ms | 114844 KB | Output is correct |
34 | Correct | 601 ms | 101172 KB | Output is correct |
35 | Correct | 701 ms | 114752 KB | Output is correct |
36 | Correct | 719 ms | 114976 KB | Output is correct |
37 | Correct | 750 ms | 115372 KB | Output is correct |
38 | Correct | 444 ms | 66752 KB | Output is correct |
39 | Correct | 474 ms | 75088 KB | Output is correct |