QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#788798 | #9621. 连方 | masttf# | WA | 0ms | 3628kb | C++20 | 2.1kb | 2024-11-27 18:20:29 | 2024-11-27 18:20:35 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
#define dbg(x...) \
do { \
cout << #x << " -> "; \
err(x); \
} while (0)
void err() {
cout << endl << endl;
}
template<class T, class... Ts>
void err(T arg, Ts ... args) {
cout << fixed << setprecision(10) << arg << ' ';
err(args...);
}
void solve(){
int n; cin >> n;
string a, b; cin >> a >> b;
int cnt1 = 0, cnt2 = 0;
for(auto x : a){
if(x == '#')cnt1++;
}
for(auto x : b){
if(x == '#')cnt2++;
}
if(cnt1 == n && cnt2 == 0){
cout << "Yes\n";
for(int i = 1; i <= 7; i++){
cout << a << '\n';
}
return ;
}
if(cnt1 == n || cnt2 == n){
cout << "No\n";
return ;
}
vector<string> ans;
ans.push_back(a);
int pa = -1, pb = -1;
for(int i = 0; i < n; i++){
if(a[i] == '#'){
if(i && a[i - 1] == '.')pa = i;
if(i + 1 < n && a[i + 1] == '.')pa = i;
}
}
for(int i = 0; i < n; i++){
if(b[i] == '#'){
if(i && b[i - 1] == '.')pb = i;
if(i + 1 < n && b[i + 1] == '.')pb = i;
}
}
string res = "";
for(auto x : a){
if(x == '#')res += '.';
else res += '#';
}
ans.push_back(res);
res = "";
for(int i = 0; i < n; i++){
if(i == pa)res += '#';
else res += '.';
}
ans.push_back(res);
string res2 = "";
for(int i = 0; i < n; i++){
if(i == pb)res2 += '#';
else res2 += '.';
}
if(pa - pb == 1){
ans.push_back(res);
}else{
string res3 = "";
for(int i = 0; i < n; i++){
if(res[i] == '.' && res2[i] == '.')res3 += '#';
else res3 += '.';
}
ans.push_back(res3);
}
ans.push_back(res2);
res = "";
for(auto x : b){
if(x == '#')res += '.';
else res += '#';
}
ans.push_back(res);
ans.push_back(b);
cout << "Yes\n";
for(auto x : ans){
cout << x << '\n';
}
return ;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
int t = 1;
cin >> t;
while(t--)solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3628kb
input:
5 4 #..# .##. 5 ##.#. .#.## 6 ###### .####. 27 .######.######.####.#.##### .####...####..#.......##### 10 ########## ##########
output:
Yes #..# .##. ...# ...# ..#. #..# .##. Yes ##.#. ..#.# ...#. ###.# ...#. #.#.. .#.## No Yes .######.######.####.#.##### #......#......#....#.#..... ......................#.... ######################.#### ......................#.... #....###....##.#######..... .####...####..#.......##### No
result:
wrong answer Testcase 5: output is NO, but jury's answer is YES.