# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
872946 | 2023-11-14T07:05:38 Z | 20163070 | Bitaro the Brave (JOI19_ho_t1) | C++14 | 321 ms | 159400 KB |
#include <bits/stdc++.h> using namespace std; #define int long long const int N=3010; int n,m; char a[N][N]; int h[N][N],h2[N][N]; //h(i,j) i<k j<l //h2(k,j) i<k j<l signed main() { cin>>n>>m; for(int i=1;i<=n;i++) { cin>>a[i]+1; } for(int l=1;l<=m;l++) { for(int i=n;i>=1;i--) { h[i][l]+=h[i+1][l]; if(a[i+1][l]=='I') h[i][l]++; } } for(int k=1;k<=n;k++) { for(int j=m;j>=1;j--) { h2[k][j]+=h2[k][j+1]; if(a[k][j+1]=='O') h2[k][j]++; } } int res=0; for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { if(a[i][j]=='J') { res+=h[i][j]*h2[i][j]; } } } cout<<res; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 0 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 0 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 3420 KB | Output is correct |
6 | Correct | 1 ms | 3420 KB | Output is correct |
7 | Correct | 1 ms | 3164 KB | Output is correct |
8 | Correct | 1 ms | 3416 KB | Output is correct |
9 | Correct | 2 ms | 3420 KB | Output is correct |
10 | Correct | 1 ms | 3164 KB | Output is correct |
11 | Correct | 1 ms | 3420 KB | Output is correct |
12 | Correct | 1 ms | 3420 KB | Output is correct |
13 | Correct | 1 ms | 3164 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 0 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 0 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 3420 KB | Output is correct |
6 | Correct | 1 ms | 3420 KB | Output is correct |
7 | Correct | 1 ms | 3164 KB | Output is correct |
8 | Correct | 1 ms | 3416 KB | Output is correct |
9 | Correct | 2 ms | 3420 KB | Output is correct |
10 | Correct | 1 ms | 3164 KB | Output is correct |
11 | Correct | 1 ms | 3420 KB | Output is correct |
12 | Correct | 1 ms | 3420 KB | Output is correct |
13 | Correct | 1 ms | 3164 KB | Output is correct |
14 | Correct | 8 ms | 9564 KB | Output is correct |
15 | Correct | 3 ms | 5976 KB | Output is correct |
16 | Correct | 5 ms | 6492 KB | Output is correct |
17 | Correct | 1 ms | 2396 KB | Output is correct |
18 | Correct | 10 ms | 10684 KB | Output is correct |
19 | Correct | 8 ms | 10256 KB | Output is correct |
20 | Correct | 9 ms | 10332 KB | Output is correct |
21 | Correct | 10 ms | 10588 KB | Output is correct |
22 | Correct | 8 ms | 10332 KB | Output is correct |
23 | Correct | 8 ms | 10440 KB | Output is correct |
24 | Correct | 10 ms | 10588 KB | Output is correct |
25 | Correct | 8 ms | 10332 KB | Output is correct |
26 | Correct | 8 ms | 10284 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 0 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 0 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 3420 KB | Output is correct |
6 | Correct | 1 ms | 3420 KB | Output is correct |
7 | Correct | 1 ms | 3164 KB | Output is correct |
8 | Correct | 1 ms | 3416 KB | Output is correct |
9 | Correct | 2 ms | 3420 KB | Output is correct |
10 | Correct | 1 ms | 3164 KB | Output is correct |
11 | Correct | 1 ms | 3420 KB | Output is correct |
12 | Correct | 1 ms | 3420 KB | Output is correct |
13 | Correct | 1 ms | 3164 KB | Output is correct |
14 | Correct | 8 ms | 9564 KB | Output is correct |
15 | Correct | 3 ms | 5976 KB | Output is correct |
16 | Correct | 5 ms | 6492 KB | Output is correct |
17 | Correct | 1 ms | 2396 KB | Output is correct |
18 | Correct | 10 ms | 10684 KB | Output is correct |
19 | Correct | 8 ms | 10256 KB | Output is correct |
20 | Correct | 9 ms | 10332 KB | Output is correct |
21 | Correct | 10 ms | 10588 KB | Output is correct |
22 | Correct | 8 ms | 10332 KB | Output is correct |
23 | Correct | 8 ms | 10440 KB | Output is correct |
24 | Correct | 10 ms | 10588 KB | Output is correct |
25 | Correct | 8 ms | 10332 KB | Output is correct |
26 | Correct | 8 ms | 10284 KB | Output is correct |
27 | Correct | 300 ms | 158876 KB | Output is correct |
28 | Correct | 12 ms | 27740 KB | Output is correct |
29 | Correct | 17 ms | 15148 KB | Output is correct |
30 | Correct | 1 ms | 2908 KB | Output is correct |
31 | Correct | 215 ms | 132364 KB | Output is correct |
32 | Correct | 271 ms | 159316 KB | Output is correct |
33 | Correct | 281 ms | 158756 KB | Output is correct |
34 | Correct | 256 ms | 152688 KB | Output is correct |
35 | Correct | 295 ms | 159312 KB | Output is correct |
36 | Correct | 276 ms | 158744 KB | Output is correct |
37 | Correct | 321 ms | 159400 KB | Output is correct |
38 | Correct | 187 ms | 131668 KB | Output is correct |
39 | Correct | 193 ms | 132012 KB | Output is correct |