# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
640956 | 2022-09-15T15:23:56 Z | kkkkkkkk | Bitaro the Brave (JOI19_ho_t1) | C++14 | 667 ms | 118484 KB |
#include <bits/stdc++.h> using namespace std; int main() { int n,m; cin >> n >> m; char c[n][m]; vector<pair<int,int> > vj; int mat_o[n][m],mat_i[n][m]; for (int i=0;i<n;i++) for (int j=0;j<m;j++) { cin >> c[i][j]; if (c[i][j]=='J') vj.push_back({i,j}); } for (int i=0;i<m;i++){ if (c[n-1][i]=='I') mat_i[n-1][i]=1; else mat_i[n-1][i]=0; } for (int i=n-2;i>=0;i--) for (int j=m-1;j>=0;j--){ if (c[i][j]=='I') mat_i[i][j]=mat_i[i+1][j]+1; else mat_i[i][j]=mat_i[i+1][j]; } for (int i=0;i<n;i++){ if (c[i][m-1]=='O') mat_o[i][m-1]=1; else mat_o[i][m-1]=0; } for (int i=n-1;i>=0;i--) for (int j=m-2;j>=0;j--){ if (c[i][j]=='O') mat_o[i][j]=mat_o[i][j+1]+1; else mat_o[i][j]=mat_o[i][j+1]; } long long brojac=0; for (int i=0;i<vj.size();i++) { int index_i=vj[i].first,index_j=vj[i].second; brojac+=mat_o[index_i][index_j]*mat_i[index_i][index_j]; } cout << brojac << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 432 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 2 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 468 KB | Output is correct |
12 | Correct | 1 ms | 304 KB | Output is correct |
13 | Correct | 1 ms | 436 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 432 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 2 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 468 KB | Output is correct |
12 | Correct | 1 ms | 304 KB | Output is correct |
13 | Correct | 1 ms | 436 KB | Output is correct |
14 | Correct | 14 ms | 2780 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 9 ms | 2100 KB | Output is correct |
17 | Correct | 1 ms | 296 KB | Output is correct |
18 | Correct | 19 ms | 3864 KB | Output is correct |
19 | Correct | 15 ms | 3028 KB | Output is correct |
20 | Correct | 17 ms | 3864 KB | Output is correct |
21 | Correct | 19 ms | 3888 KB | Output is correct |
22 | Correct | 18 ms | 3788 KB | Output is correct |
23 | Correct | 16 ms | 3788 KB | Output is correct |
24 | Correct | 19 ms | 3788 KB | Output is correct |
25 | Correct | 15 ms | 3028 KB | Output is correct |
26 | Correct | 16 ms | 3776 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 432 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 2 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 468 KB | Output is correct |
12 | Correct | 1 ms | 304 KB | Output is correct |
13 | Correct | 1 ms | 436 KB | Output is correct |
14 | Correct | 14 ms | 2780 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 9 ms | 2100 KB | Output is correct |
17 | Correct | 1 ms | 296 KB | Output is correct |
18 | Correct | 19 ms | 3864 KB | Output is correct |
19 | Correct | 15 ms | 3028 KB | Output is correct |
20 | Correct | 17 ms | 3864 KB | Output is correct |
21 | Correct | 19 ms | 3888 KB | Output is correct |
22 | Correct | 18 ms | 3788 KB | Output is correct |
23 | Correct | 16 ms | 3788 KB | Output is correct |
24 | Correct | 19 ms | 3788 KB | Output is correct |
25 | Correct | 15 ms | 3028 KB | Output is correct |
26 | Correct | 16 ms | 3776 KB | Output is correct |
27 | Correct | 610 ms | 114484 KB | Output is correct |
28 | Correct | 2 ms | 724 KB | Output is correct |
29 | Correct | 49 ms | 8700 KB | Output is correct |
30 | Correct | 2 ms | 596 KB | Output is correct |
31 | Correct | 457 ms | 77664 KB | Output is correct |
32 | Correct | 562 ms | 94628 KB | Output is correct |
33 | Correct | 561 ms | 116636 KB | Output is correct |
34 | Correct | 597 ms | 103440 KB | Output is correct |
35 | Correct | 609 ms | 118484 KB | Output is correct |
36 | Correct | 581 ms | 116676 KB | Output is correct |
37 | Correct | 667 ms | 117776 KB | Output is correct |
38 | Correct | 380 ms | 68264 KB | Output is correct |
39 | Correct | 383 ms | 77480 KB | Output is correct |