QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#767402 | #9621. 连方 | OOBMABTRAMS# | WA | 19ms | 3720kb | C++17 | 1.1kb | 2024-11-20 20:51:04 | 2024-11-20 20:51:10 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
constexpr int N=1000013;
typedef long long ll;
typedef long double ld;
string s[10];
const char v='#'^'.';
void solve(){
int n;cin>>n;
cin>>s[1]>>s[7];
s[2]=s[1];
int c1=0;
for(int i=0;i<n;i++)s[2][i]^=v,c1+=s[2][i]=='#';
s[6]=s[7];
int c2=0;
for(int i=0;i<n;i++)s[6][i]^=v,c2+=s[6][i]=='#';
if(c1==0&&c2==0){
cout<<"Yes\n";
for(int i=1;i<=7;i++)cout<<s[1]<<'\n';
return;
}
if(c1==0||c2==0) {
cout<<"No\n";
return;
}
cout<<"Yes\n";
c1=c2=-1;
for(int i=0;i+1<n;i++)if(s[2][i+1]=='#')c1=i;
for(int i=0;i+1<n;i++)if(s[6][i+1]=='#')c2=i;
for(int i=1;i<n;i++)if(s[2][i-1]=='#')c1=i;
for(int i=1;i<n;i++)if(s[6][i-1]=='#')c2=i;
s[3]=s[5]=s[4]="";
for(int i=0;i<n;i++)s[3]+='.',s[5]+='.',s[4]+='.';
s[3][c1]=s[5][c2]='#';
if(c1>c2)swap(c1,c2);
if(c2-c1<=1) {
s[4][c1]='#';
}else {
for(int i=c1+1;i<c2;i++)s[4][i]='#';
}
for(int i=1;i<=7;i++)cout<<s[i]<<'\n';
}
//
signed main(){
int T=1;cin>>T;
while(T--) solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3656kb
input:
5 4 #..# .##. 5 ##.#. .#.## 6 ###### .####. 27 .######.######.####.#.##### .####...####..#.......##### 10 ########## ##########
output:
Yes #..# .##. ...# ..#. .#.. #..# .##. Yes ##.#. ..#.# ...#. ...#. ...#. #.#.. .#.## No Yes .######.######.####.#.##### #......#......#....#.#..... ......................#.... ......................#.... ......................#.... #....###....##.#######..... .####...####..#.......##### Yes ########...
result:
ok Correct.
Test #2:
score: -100
Wrong Answer
time: 19ms
memory: 3720kb
input:
10000 6 .#..## ..#... 5 #..#. ##... 6 .###.# ...### 17 .####..#######..# ###########.##### 6 ..##.# #.##.# 25 #.##.##############.####. ####################.##.# 9 ##.#..##. ##..##### 6 .###.# ##.### 6 ###..# #.#### 25 #####################.#.# ######.################## 6 .#.### .##..# 6 ..#### #......
output:
Yes .#..## #.##.. ....#. ....#. .....# ##.### ..#... Yes #..#. .##.# ...#. ...#. ....# ..### ##... Yes .###.# #...#. .....# ....#. ...#.. ###... ...### Yes .####..#######..# #....##.......##. ................# .............###. ............#.... ...........#..... ###########.##### Yes ..##.# ##..#. ...
result:
wrong answer Testcase 1: Rectangular condition failed.