QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#864436 | #9621. 连方 | zty02281128 | WA | 14ms | 3584kb | C++17 | 2.5kb | 2025-01-20 16:36:23 | 2025-01-20 16:36:27 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int T,n;
char s[1000005],t[1000005];
int a,b;
int main(){
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin>>T;
while(T--){
cin>>n;a=b=0;
for(int i=1;i<=n;i++) cin>>s[i];
for(int i=1;i<=n;i++) cin>>t[i];
for(int i=1;i<=n;i++){
if(s[i]=='#') a++;
if(t[i]=='#') b++;
}
if(a==n&&b==n){
cout<<"Yes"<<'\n';
for(int i=1;i<=7;i++){
for(int j=1;j<=n;j++){
cout<<'#';
}
cout<<'\n';
}
continue;
}
if(!a&&!b){
cout<<"Yes"<<'\n';
for(int i=1;i<=7;i++){
for(int j=1;j<=n;j++){
cout<<'.';
}
cout<<'\n';
}
continue;
}
if(a==n||b==n){
cout<<"No"<<'\n';
continue;
}
if(!a||!b){
cout<<"Yes"<<'\n';
for(int i=1;i<=n;i++) cout<<s[i];cout<<'\n';
for(int i=1;i<=n;i++){
if(s[i]=='#') cout<<'.';
else cout<<'#';
}
cout<<'\n';
for(int i=3;i<=5;i++){
for(int j=1;j<=n;j++) cout<<'.';
cout<<"\n";
}
for(int i=1;i<=n;i++){
if(t[i]=='#') cout<<'.';
else cout<<'#';
}
cout<<'\n';
for(int i=1;i<=n;i++) cout<<t[i];
cout<<'\n';
}
cout<<"Yes"<<'\n';
for(int i=1;i<=n;i++) cout<<s[i];cout<<'\n';
for(int i=1;i<=n;i++){
if(s[i]=='#') cout<<'.';
else cout<<'#';
}
cout<<'\n';
int pos1=1,pos2=1;
while(s[pos1]!='#') pos1++;
while(s[pos1+1]=='#') pos1++;
while(t[pos2]!='#') pos2++;
for(int i=1;i<pos1;i++) cout<<'.';
cout<<'#';
for(int i=pos1+1;i<=n;i++) cout<<'.';
cout<<'\n';
if(pos1<pos2-1){
for(int i=1;i<=pos1;i++) cout<<'.';
for(int i=pos1+1;i<pos2;i++) cout<<'#';
for(int i=pos2;i<=n;i++) cout<<'.';
cout<<'\n';
}
else if(pos1==pos2-1){
for(int i=1;i<=pos1;i++) cout<<'.';
cout<<'#';
for(int i=pos2+1;i<=n;i++) cout<<'.';
cout<<'\n';
}
else if(pos1==pos2){
for(int i=1;i<pos1;i++) cout<<'.';
cout<<'#';
for(int i=pos2+1;i<=n;i++) cout<<'.';
cout<<'\n';
}
else if(pos1==pos2+1){
for(int i=1;i<=pos2;i++) cout<<'.';
cout<<'#';
for(int i=pos1+1;i<=n;i++) cout<<'.';
cout<<'\n';
}
else{
for(int i=1;i<=pos2;i++) cout<<'.';
for(int i=pos2+1;i<pos1;i++) cout<<'#';
for(int i=pos1;i<=n;i++) cout<<'.';
cout<<'\n';
}
for(int i=1;i<pos2;i++) cout<<'.';
cout<<'#';
for(int i=pos2+1;i<=n;i++) cout<<'.';
cout<<'\n';
for(int i=1;i<=n;i++){
if(t[i]=='#') cout<<'.';
else cout<<'#';
}
cout<<'\n';
for(int i=1;i<=n;i++) cout<<t[i];
cout<<'\n';
}
return 0;
}
/*
4
4
#..#
.##.
5
##.#.
.#.##
6
######
.####.
27
.######.######.####.#.#####
.####...####..#.......#####
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3584kb
input:
5 4 #..# .##. 5 ##.#. .#.## 6 ###### .####. 27 .######.######.####.#.##### .####...####..#.......##### 10 ########## ##########
output:
Yes #..# .##. #... .#.. .#.. #..# .##. Yes ##.#. ..#.# .#... .#... .#... #.#.. .#.## No Yes .######.######.####.#.##### #......#......#....#.#..... ......#.................... ..####..................... .#......................... #....###....##.#######..... .####...####..#.......##### Yes ########...
result:
ok Correct.
Test #2:
score: -100
Wrong Answer
time: 14ms
memory: 3584kb
input:
10000 6 .#..## ..#... 5 #..#. ##... 6 .###.# ...### 17 .####..#######..# ###########.##### 6 ..##.# #.##.# 25 #.##.##############.####. ####################.##.# 9 ##.#..##. ##..##### 6 .###.# ##.### 6 ###..# #.#### 25 #####################.#.# ######.################## 6 .#.### .##..# 6 ..#### #......
output:
Yes .#..## #.##.. .#.... ..#... ..#... ##.### ..#... Yes #..#. .##.# #.... #.... #.... ..### ##... Yes .###.# #...#. ...#.. ...#.. ...#.. ###... ...### Yes .####..#######..# #....##.......##. ....#............ .###............. #................ ...........#..... ###########.##### Yes ..##.# ##..#. ...
result:
wrong answer Testcase 2: Connected condition failed.