Submission #1087236

# Submission time Handle Problem Language Result Execution time Memory
1087236 2024-09-12T10:58:06 Z Tesla89 Bitaro the Brave (JOI19_ho_t1) C++14
20 / 100
6 ms 6876 KB
#include <bits/stdc++.h>

using namespace std;

int sufw[3001][3001],sufh[3001][3001];

int 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 344 KB Output is correct
2 Correct 0 ms 348 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 1116 KB Output is correct
6 Correct 1 ms 1116 KB Output is correct
7 Correct 1 ms 1116 KB Output is correct
8 Correct 1 ms 1116 KB Output is correct
9 Correct 0 ms 1116 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1116 KB Output is correct
12 Correct 1 ms 1116 KB Output is correct
13 Correct 1 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 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 1116 KB Output is correct
6 Correct 1 ms 1116 KB Output is correct
7 Correct 1 ms 1116 KB Output is correct
8 Correct 1 ms 1116 KB Output is correct
9 Correct 0 ms 1116 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1116 KB Output is correct
12 Correct 1 ms 1116 KB Output is correct
13 Correct 1 ms 1116 KB Output is correct
14 Correct 5 ms 6236 KB Output is correct
15 Correct 1 ms 3676 KB Output is correct
16 Correct 2 ms 3800 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 6 ms 6876 KB Output is correct
19 Correct 5 ms 6748 KB Output is correct
20 Incorrect 4 ms 6748 KB Output isn't correct
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 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 1116 KB Output is correct
6 Correct 1 ms 1116 KB Output is correct
7 Correct 1 ms 1116 KB Output is correct
8 Correct 1 ms 1116 KB Output is correct
9 Correct 0 ms 1116 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1116 KB Output is correct
12 Correct 1 ms 1116 KB Output is correct
13 Correct 1 ms 1116 KB Output is correct
14 Correct 5 ms 6236 KB Output is correct
15 Correct 1 ms 3676 KB Output is correct
16 Correct 2 ms 3800 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 6 ms 6876 KB Output is correct
19 Correct 5 ms 6748 KB Output is correct
20 Incorrect 4 ms 6748 KB Output isn't correct
21 Halted 0 ms 0 KB -