QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#809941 | #9621. 连方 | Nana7# | WA | 21ms | 5752kb | C++14 | 1.5kb | 2024-12-11 18:25:46 | 2024-12-11 18:25:52 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<queue>
#include<vector>
#define I inline
using namespace std;
const int N = 100100;
char up[N],dn[N];
int ans[8][N];
int n;
I void solve() {
cin>>n;
scanf("%s",up+1);
scanf("%s",dn+1);
for(int i=1;i<=n;++i)
for(int j=1;j<=7;++j) ans[j][i]=0;
for(int i=1;i<=n;++i) {
ans[1][i]=(up[i]=='#');
ans[7][i]=(dn[i]=='#');
}
for(int i=1;i<=n;++i) {
ans[2][i]=1-ans[1][i];
ans[6][i]=1-ans[7][i];
}
bool f1=1,f2=1,c=1;
for(int i=1;i<=n;++i) {
if(!ans[1][i]) f1=0;
if(!ans[7][i]) f2=0;
if(ans[1][i]||ans[7][i]) c=0;
}
if(c) {
cout<<"Yes"<<endl;
for(int i=1;i<=7;++i) {
for(int j=1;j<=n;++j) putchar('.');
putchar('\n');
}
return ;
}
if(f1&&f2) {
cout<<"Yes"<<endl;
for(int i=1;i<=7;++i) {
for(int j=1;j<=n;++j) putchar('#');
putchar('\n');
}
return ;
}
if(f1||f2) {
cout<<"No"<<endl;
return ;
}
cout<<"Yes"<<endl;
bool pd=0;
for(int i=1;i<=n;++i) {
if(ans[2][i]==ans[6][i]&&!ans[2][i]) {
pd=1;
for(int j=3;j<=5;++j) {
ans[j][i]=1;
}
}
}
if(!pd) {
for(int i=1;i<=n;++i) ans[3][i]=ans[1][i];
for(int i=1;i<=n;++i) {
if(ans[3][i]==ans[6][i]&&!ans[3][i]) {
for(int j=4;j<=5;++j) {
ans[j][i]=1;
}
}
}
}
for(int i=1;i<=7;++i) {
for(int j=1;j<=n;++j) {
if(ans[i][j]) putchar('#');
else putchar('.');
} putchar('\n');
}
}
int main()
{
int T; cin>>T;
while(T--) {
solve();
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 5752kb
input:
5 4 #..# .##. 5 ##.#. .#.## 6 ###### .####. 27 .######.######.####.#.##### .####...####..#.......##### 10 ########## ##########
output:
Yes #..# .##. #..# .##. .##. #..# .##. Yes ##.#. ..#.# .#.#. .#.#. .#.#. #.#.. .#.## No Yes .######.######.####.#.##### #......#......#....#.#..... .####...####..........##### .####...####..........##### .####...####..........##### #....###....##.#######..... .####...####..#.......##### Yes ########...
result:
ok Correct.
Test #2:
score: -100
Wrong Answer
time: 21ms
memory: 3940kb
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.