답안 #936626

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
936626 2024-03-02T12:17:11 Z adkjt Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
249 ms 129364 KB
#include<bits/stdc++.h>
using namespace std;
/*struct O
{
    int l,i;
    bool operator<(const O&o)const{
        return l<o.l;
    }
};
struct I
{
    int k,j;
    bool operator<(const I&o)const{
        return k<o.k;
    }
};*/
char t[3333][3333];
int qso[3333][3333];
int qsi[3333][3333];
queue<pair<int,int>> J;
int main()
{
    cin.tie()->sync_with_stdio(0);
    int r,c;cin>>r>>c;
    for(int i= 1;i<=r;i++)
        for(int j=1;j<=c;j++)
    {
        cin>>t[i][j];
        if(t[i][j]=='J')
        J.push({i,j});
        else if(t[i][j]=='O')
            qso[i][j]=1;
        else
            qsi[i][j]=1;
    }
    long long ans=0;
    for(int i=1;i<=r;i++)
    {
        for(int j=1;j<=c;j++)
        {
            qso[i][j]+=qso[i][j-1];
            qsi[i][j]+=qsi[i-1][j];
        }
    }
    while(!J.empty())
    {
        pair<int,int> now=J.front();
       // cout<<now.first<<' '<<now.second<<'\n';
        J.pop();
        ans+=(qso[now.first][c]-qso[now.first][now.second])*(qsi[r][now.second]-qsi[now.first][now.second]);
    }

    cout<<ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4560 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 6488 KB Output is correct
8 Correct 1 ms 6488 KB Output is correct
9 Correct 1 ms 6492 KB Output is correct
10 Correct 1 ms 6624 KB Output is correct
11 Correct 1 ms 6744 KB Output is correct
12 Correct 2 ms 6744 KB Output is correct
13 Correct 2 ms 6492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4560 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 6488 KB Output is correct
8 Correct 1 ms 6488 KB Output is correct
9 Correct 1 ms 6492 KB Output is correct
10 Correct 1 ms 6624 KB Output is correct
11 Correct 1 ms 6744 KB Output is correct
12 Correct 2 ms 6744 KB Output is correct
13 Correct 2 ms 6492 KB Output is correct
14 Correct 9 ms 21596 KB Output is correct
15 Correct 2 ms 14684 KB Output is correct
16 Correct 4 ms 11180 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 11 ms 21852 KB Output is correct
19 Correct 7 ms 21340 KB Output is correct
20 Correct 8 ms 21852 KB Output is correct
21 Correct 9 ms 21952 KB Output is correct
22 Correct 9 ms 21852 KB Output is correct
23 Correct 7 ms 21848 KB Output is correct
24 Correct 10 ms 22108 KB Output is correct
25 Correct 7 ms 21384 KB Output is correct
26 Correct 7 ms 21852 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4560 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 6488 KB Output is correct
8 Correct 1 ms 6488 KB Output is correct
9 Correct 1 ms 6492 KB Output is correct
10 Correct 1 ms 6624 KB Output is correct
11 Correct 1 ms 6744 KB Output is correct
12 Correct 2 ms 6744 KB Output is correct
13 Correct 2 ms 6492 KB Output is correct
14 Correct 9 ms 21596 KB Output is correct
15 Correct 2 ms 14684 KB Output is correct
16 Correct 4 ms 11180 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 11 ms 21852 KB Output is correct
19 Correct 7 ms 21340 KB Output is correct
20 Correct 8 ms 21852 KB Output is correct
21 Correct 9 ms 21952 KB Output is correct
22 Correct 9 ms 21852 KB Output is correct
23 Correct 7 ms 21848 KB Output is correct
24 Correct 10 ms 22108 KB Output is correct
25 Correct 7 ms 21384 KB Output is correct
26 Correct 7 ms 21852 KB Output is correct
27 Correct 249 ms 122128 KB Output is correct
28 Correct 9 ms 68700 KB Output is correct
29 Correct 13 ms 13148 KB Output is correct
30 Correct 2 ms 4700 KB Output is correct
31 Correct 175 ms 99580 KB Output is correct
32 Correct 189 ms 106836 KB Output is correct
33 Correct 161 ms 124300 KB Output is correct
34 Correct 207 ms 115720 KB Output is correct
35 Correct 228 ms 123392 KB Output is correct
36 Correct 160 ms 124144 KB Output is correct
37 Correct 246 ms 129364 KB Output is correct
38 Correct 118 ms 87800 KB Output is correct
39 Correct 134 ms 99592 KB Output is correct