Submission #936935

# Submission time Handle Problem Language Result Execution time Memory
936935 2024-03-03T04:27:50 Z detectivebowon Bitaro the Brave (JOI19_ho_t1) C++14
20 / 100
14 ms 13412 KB
#include<bits/stdc++.h>
using namespace std;
int h,w,qso[3007][3007],qsi[3007][3007],ans;
char space[3007][3007];
queue<pair<int,int>> q;
int main()
{
    cin>>h>>w;
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            cin>>space[i][j];
            if(space[i][j]=='J')
            {
                q.push({i,j});
            }
        }
    }
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            if(space[i][j]=='I')
                qsi[i][j]=qsi[i-1][j]+1;
            else
                qsi[i][j]=qsi[i-1][j];
            if(space[i][j]=='O')
                qso[i][j]=qso[i][j-1]+1;
            else
                qso[i][j]=qso[i][j-1];
        }
    }
    while(!q.empty())
    {
        int x=q.front().first;
        int y=q.front().second;
        q.pop();
        ans+=(qsi[h][y]-qsi[x][y])*(qso[x][w]-qso[x][y]);
//        cout<<x<<" "<<y<<" "<<ans<<" "<<qsi[h][y]<<" "<<qso[x][w]<<"\n";
    }
    cout<<ans;
//    for(int i=1;i<=h;i++)
//    {
//        for(int j=1;j<=w;j++)
//        {
//            cout<<qsi[i][j]<<" ";
//        }
//        cout<<"\n";
//    }

}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 3 ms 3420 KB Output is correct
6 Correct 2 ms 3416 KB Output is correct
7 Correct 1 ms 3416 KB Output is correct
8 Correct 1 ms 3416 KB Output is correct
9 Correct 1 ms 3516 KB Output is correct
10 Correct 1 ms 3420 KB Output is correct
11 Correct 2 ms 3420 KB Output is correct
12 Correct 2 ms 3420 KB Output is correct
13 Correct 1 ms 3416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 3 ms 3420 KB Output is correct
6 Correct 2 ms 3416 KB Output is correct
7 Correct 1 ms 3416 KB Output is correct
8 Correct 1 ms 3416 KB Output is correct
9 Correct 1 ms 3516 KB Output is correct
10 Correct 1 ms 3420 KB Output is correct
11 Correct 2 ms 3420 KB Output is correct
12 Correct 2 ms 3420 KB Output is correct
13 Correct 1 ms 3416 KB Output is correct
14 Correct 11 ms 12892 KB Output is correct
15 Correct 2 ms 9052 KB Output is correct
16 Correct 8 ms 7516 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 14 ms 13400 KB Output is correct
19 Correct 11 ms 12892 KB Output is correct
20 Incorrect 12 ms 13412 KB Output isn't correct
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 3 ms 3420 KB Output is correct
6 Correct 2 ms 3416 KB Output is correct
7 Correct 1 ms 3416 KB Output is correct
8 Correct 1 ms 3416 KB Output is correct
9 Correct 1 ms 3516 KB Output is correct
10 Correct 1 ms 3420 KB Output is correct
11 Correct 2 ms 3420 KB Output is correct
12 Correct 2 ms 3420 KB Output is correct
13 Correct 1 ms 3416 KB Output is correct
14 Correct 11 ms 12892 KB Output is correct
15 Correct 2 ms 9052 KB Output is correct
16 Correct 8 ms 7516 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 14 ms 13400 KB Output is correct
19 Correct 11 ms 12892 KB Output is correct
20 Incorrect 12 ms 13412 KB Output isn't correct
21 Halted 0 ms 0 KB -