Submission #1087237

# Submission time Handle Problem Language Result Execution time Memory
1087237 2024-09-12T10:59:02 Z Tesla89 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
229 ms 160428 KB
#include <bits/stdc++.h>
#define int long long

using namespace std;

int sufw[3010][3010],sufh[3010][3010];

signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int h,w,res=0;
    cin>>h>>w;
    string a[h];
    for(int i=0;i<h;i++)cin>>a[i];
    for(int i=0;i<w;i++){
        for(int j=h-1;j>=0;j--){
            sufh[j][i]=sufh[j+1][i]+(a[j][i]=='I');
        }
    }
    for(int i=0;i<h;i++){
        for(int j=w-1;j>=0;j--){
            sufw[i][j]=sufw[i][j+1]+(a[i][j]=='O');
        }
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(a[i][j]!='J')continue;
            res+=sufh[i][j]*sufw[i][j];
        }
    }
    cout<<res<<'\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 460 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 1372 KB Output is correct
6 Correct 1 ms 1368 KB Output is correct
7 Correct 1 ms 1116 KB Output is correct
8 Correct 1 ms 1372 KB Output is correct
9 Correct 1 ms 1368 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1372 KB Output is correct
12 Correct 1 ms 1372 KB Output is correct
13 Correct 1 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 460 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 1372 KB Output is correct
6 Correct 1 ms 1368 KB Output is correct
7 Correct 1 ms 1116 KB Output is correct
8 Correct 1 ms 1372 KB Output is correct
9 Correct 1 ms 1368 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1372 KB Output is correct
12 Correct 1 ms 1372 KB Output is correct
13 Correct 1 ms 1116 KB Output is correct
14 Correct 5 ms 7768 KB Output is correct
15 Correct 2 ms 3928 KB Output is correct
16 Correct 3 ms 4700 KB Output is correct
17 Correct 0 ms 604 KB Output is correct
18 Correct 6 ms 8780 KB Output is correct
19 Correct 5 ms 8740 KB Output is correct
20 Correct 5 ms 8540 KB Output is correct
21 Correct 6 ms 8796 KB Output is correct
22 Correct 5 ms 8540 KB Output is correct
23 Correct 6 ms 8536 KB Output is correct
24 Correct 6 ms 8792 KB Output is correct
25 Correct 5 ms 8572 KB Output is correct
26 Correct 5 ms 8540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 460 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 1372 KB Output is correct
6 Correct 1 ms 1368 KB Output is correct
7 Correct 1 ms 1116 KB Output is correct
8 Correct 1 ms 1372 KB Output is correct
9 Correct 1 ms 1368 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1372 KB Output is correct
12 Correct 1 ms 1372 KB Output is correct
13 Correct 1 ms 1116 KB Output is correct
14 Correct 5 ms 7768 KB Output is correct
15 Correct 2 ms 3928 KB Output is correct
16 Correct 3 ms 4700 KB Output is correct
17 Correct 0 ms 604 KB Output is correct
18 Correct 6 ms 8780 KB Output is correct
19 Correct 5 ms 8740 KB Output is correct
20 Correct 5 ms 8540 KB Output is correct
21 Correct 6 ms 8796 KB Output is correct
22 Correct 5 ms 8540 KB Output is correct
23 Correct 6 ms 8536 KB Output is correct
24 Correct 6 ms 8792 KB Output is correct
25 Correct 5 ms 8572 KB Output is correct
26 Correct 5 ms 8540 KB Output is correct
27 Correct 195 ms 159088 KB Output is correct
28 Correct 8 ms 19548 KB Output is correct
29 Correct 11 ms 13908 KB Output is correct
30 Correct 1 ms 856 KB Output is correct
31 Correct 130 ms 131016 KB Output is correct
32 Correct 161 ms 160140 KB Output is correct
33 Correct 167 ms 159852 KB Output is correct
34 Correct 168 ms 151920 KB Output is correct
35 Correct 178 ms 160200 KB Output is correct
36 Correct 168 ms 159756 KB Output is correct
37 Correct 229 ms 160428 KB Output is correct
38 Correct 116 ms 130132 KB Output is correct
39 Correct 125 ms 130388 KB Output is correct