QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#529252 | #6398. Puzzle: Tapa | solar_express# | RE | 0ms | 3708kb | C++20 | 1.2kb | 2024-08-24 11:04:45 | 2024-08-24 11:04:45 |
Judging History
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 ......