QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#529252#6398. Puzzle: Tapasolar_express#RE 0ms3708kbC++201.2kb2024-08-24 11:04:452024-08-24 11:04:45

Judging History

你现在查看的是最新测评结果

  • [2024-08-24 11:04:45]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:3708kb
  • [2024-08-24 11:04:45]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n,m;
string s[55];
int mch[55][55];
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>m;
    for(int i=1;i<=n*2-1;++i){
        cin>>s[i];
        for(int j=1;j<=m*2-1;++j)
            if(s[i][j-1]=='.') s[i][j-1]='#';
    }
    for(int i=1;i<=n;++i){
        for(int j=1;j<=m;++j){
            int val=8;
            int cnt=0;
            if(i==1||i==n) ++cnt;
            if(j==1||j==m) ++cnt;
            if(cnt==1) val=5;
            if(cnt==2) val=3;
            if(val!=s[i*2-1][j*2-2]-'0')
                mch[i][j]=1;
        }
    }
    for(int i=1;i<=n;++i){
        for(int j=1;j<=m;++j) if(mch[i][j]){
            if((j==1||j==m||(i>2&&i<n))&&mch[i-1][j]){
                mch[i-1][j]=mch[i][j]=0;
                s[i*2-2][j*2-2]='.';
            }else if((i==1||i==n||(j>2&&j<m))&&mch[i][j-1]){
                mch[i][j-1]=mch[i][j]=0;
                s[i*2-1][j*2-3]='.';
            }
        }
    }
    for(int i=1;i<=n;++i) 
        for(int j=1;j<=m;++j)
            if(mch[i][j]){
                cout<<"NO\n";
                return 0;
            }
    cout<<"YES\n";
    for(int i=1;i<=n*2-1;++i)
        cout<<s[i]<<'\n';
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3668kb

input:

3 3
2.4.3
.....
5.8.5
.....
3.5.3

output:

YES
2.4#3
#####
5#8#5
#####
3#5#3

result:

ok Correct.

Test #2:

score: 0
Accepted
time: 0ms
memory: 3708kb

input:

3 3
3.4.3
.....
5.7.5
.....
3.5.3

output:

NO

result:

ok Correct.

Test #3:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

2 2
2.2
...
2.2

output:

YES
2.2
###
2.2

result:

ok Correct.

Test #4:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

2 50
2.4.4.4.4.5.5.5.5.5.5.5.5.4.5.5.4.4.5.5.5.5.4.5.5.5.5.5.4.4.5.4.5.5.5.5.5.5.5.5.5.5.5.4.4.5.5.4.5.3
...................................................................................................
2.5.5.4.4.5.5.5.4.4.5.5.5.4.5.5.5.5.5.5.5.5.4.4.4.5.5.5.5.5.5.4.4.4.5.5.5.5.5.5.5.4.4.5.5.5.5.4...

output:

NO

result:

ok Correct.

Test #5:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

2 50
2.4.4.5.5.5.5.5.5.5.5.5.4.4.5.5.5.5.4.4.5.5.4.4.5.5.5.4.5.4.4.4.5.4.4.5.4.4.5.5.5.5.4.4.5.5.5.5.5.2
...................................................................................................
3.5.4.5.5.5.5.5.5.5.5.5.5.5.4.5.5.5.5.4.5.5.5.5.4.4.5.4.5.4.5.5.5.5.5.4.4.5.5.5.4.4.5.5.5.5.5.4...

output:

NO

result:

ok Correct.

Test #6:

score: -100
Runtime Error

input:

50 2
3.2
...
5.4
...
5.5
...
4.4
...
5.5
...
5.5
...
5.5
...
5.5
...
5.5
...
5.5
...
5.5
...
5.4
...
5.4
...
5.5
...
5.5
...
5.5
...
5.5
...
5.5
...
5.4
...
5.4
...
5.4
...
5.4
...
4.4
...
5.5
...
5.5
...
4.4
...
5.4
...
5.4
...
5.5
...
4.5
...
4.5
...
5.5
...
5.5
...
5.5
...
5.5
...
5.5
...
5.5
......

output:


result: