QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#767365 | #9621. 连方 | OOBMABTRAMS# | WA | 11ms | 3684kb | C++17 | 934b | 2024-11-20 20:43:28 | 2024-11-20 20:43:35 |
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;
}
if(c1<=n/2)s[3]=s[2];else s[3]=s[1];
if(c2<=n/2)s[5]=s[6];else s[5]=s[7];
int c3=0;
s[4]="";
for(int i=0;i<n;i++)if(s[3][i]=='#'||s[5][i]=='#')s[4]+='.';else s[4]+='#',c3++;
if(!c3) s[4]=s[3];
cout<<"Yes\n";
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: 3636kb
input:
5 4 #..# .##. 5 ##.#. .#.## 6 ###### .####. 27 .######.######.####.#.##### .####...####..#.......##### 10 ########## ##########
output:
Yes #..# .##. .##. .##. #..# #..# .##. Yes ##.#. ..#.# ..#.# .#.#. #.#.. #.#.. .#.## No Yes .######.######.####.#.##### #......#......#....#.#..... #......#......#....#.#..... .####...####..........##### #....###....##.#######..... #....###....##.#######..... .####...####..#.......##### Yes ########...
result:
ok Correct.
Test #2:
score: -100
Wrong Answer
time: 11ms
memory: 3684kb
input:
10000 6 .#..## ..#... 5 #..#. ##... 6 .###.# ...### 17 .####..#######..# ###########.##### 6 ..##.# #.##.# 25 #.##.##############.####. ####################.##.# 9 ##.#..##. ##..##### 6 .###.# ##.### 6 ###..# #.#### 25 #####################.#.# ######.################## 6 .#.### .##..# 6 ..#### #......
output:
Yes .#..## #.##.. #.##.. .#..## ..#... ##.### ..#... Yes #..#. .##.# #..#. ..#.# ##... ..### ##... Yes .###.# #...#. #...#. ...#.# ###... ###... ...### Yes .####..#######..# #....##.......##. #....##.......##. .####..####.##..# ...........#..... ...........#..... ###########.##### Yes ..##.# ##..#. ...
result:
wrong answer Testcase 6: Connected condition failed.