답안 #599374

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
599374 2022-07-19T13:12:24 Z KarolZ Dango Maker (JOI18_dango_maker) C++14
13 / 100
1 ms 340 KB
#include<iostream>
#include<queue>
using namespace std;
int t[3010][3010];
int il[3010][3010];
priority_queue< pair<int,pair<pair<int,int>,bool> > >pq;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
    int n,m,licz=0,x,y,kt;
    string s;
    cin>>n>>m;
    for(int i=2;i<=n+1;i++){
        cin>>s;
        for(int j=2;j<=m+1;j++){
            if(s[j-2]=='R')t[i][j]=1;
            if(s[j-2]=='G')t[i][j]=2;
            if(s[j-2]=='W')t[i][j]=3;
        }
    }
    for(int i=2;i<=n+1;i++){
        for(int j=2;j<=m+1;j++){
            if(t[i][j]==1){
                if(t[i][j+1]==2&&t[i][j+2]==3){
                    il[i][j]++;
                    il[i][j+1]++;
                    il[i][j+2]++;
                    licz++;
                }
                if(t[i+1][j]==2&&t[i+2][j]==3){
                    il[i][j]++;
                    il[i+1][j]++;
                    il[i+2][j]++;
                    licz++;
                }
            }
        }
    }
    //cout<<licz<<'\n';
    for(int i=2;i<=n+1;i++){
        for(int j=2;j<=m+1;j++){
            if(t[i][j]==1){
                if(t[i][j+1]==2&&t[i][j+2]==3){
                    pq.push({il[i][j]+il[i][j+1]+il[i][j+2],{{i,j},0}});
                }
                if(t[i+1][j]==2&&t[i+2][j]==3){
                    pq.push({il[i][j]+il[i+1][j]+il[i+2][j],{{i,j},1}});
                }
            }
        }
    }
    while(!pq.empty()){
        if(pq.top().first==3)break;
        x=pq.top().second.first.first;
        y=pq.top().second.first.second;
        kt=pq.top().second.second;
        pq.pop();
        if(kt==0){
            if(il[x][y]+il[x][y+1]+il[x][y+2]>3){
                licz--;
                il[x][y]--;
                il[x][y+1]--;
                il[x][y+2]--;
            }
        }
        if(kt==1){
            if(il[x][y]+il[x+1][y]+il[x+2][y]>3){
                licz--;
                il[x][y]--;
                il[x+1][y]--;
                il[x+2][y]--;
            }
        }
    }
    cout<<licz;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Correct 0 ms 340 KB Output is correct
19 Correct 0 ms 332 KB Output is correct
20 Incorrect 1 ms 340 KB Output isn't correct
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Correct 0 ms 340 KB Output is correct
19 Correct 0 ms 332 KB Output is correct
20 Incorrect 1 ms 340 KB Output isn't correct
21 Halted 0 ms 0 KB -