QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#772848 | #9621. 连方 | CodyLee# | RE | 0ms | 0kb | C++23 | 2.3kb | 2024-11-22 22:23:33 | 2024-11-22 22:23:36 |
answer
#include<bits/stdc++.h>
#define x first
#define y second
#define endl '\n'
#define debug(x) cout<<#x<<" = "<<x<<endl
#define pb push_back
#define maxheap(x) priority_queue<x,vector<x>,less<x> >
#define minheap(x) priority_queue<x,vector<x>,greater<x> >
#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
const int N = 2e6 + 10;
const int INF = 2147483647;
ll e[N];
typedef pair<int,int> pii;
ll qpow(ll a,ll b,ll p)
{
ll res = 1;
while(b > 0)
{
if(b & 1) res = res * a % p;
a = a * a % p;b >>= 1;
}
return res;
}
ll exgcd(ll a,ll b,ll &x,ll &y)
{
if(b == 0)
{
x = 1,y = 0;
return a;
}
ll d = exgcd(b,a % b,y,x);
y -= a / b * x;
return d;
}
void solve()
{
int n;
cin >> n;
string a,b;
cin >> a >> b;
int cnt = 0;
for(int i = 0;i < n;i ++)
{
if(a[i] == '.')
{
cnt ++;
break;
}
}
for(int i = 0;i < n;i ++)
{
if(b[i] == '.')
{
cnt ++;
break;
}
}
if(cnt == 0)
{
cout << "Yes" << endl;
for(int i = 1;i <= 7;i ++)
{
for(int j = 0;j < n;j ++)
cout << '#';
cout << endl;
}
return ;
}
int flag = 0;
for(int i = 0; i < n; i ++) {
if(a[i] == '#') {
flag ++;
break;
}
}
for(int i = 0; i < n; i ++) {
if(b[i] == '#') {
flag ++;
break;
}
}
//cout << cnt << flag;
if(cnt == 1 && flag == 2)
{
cout << "No" << endl;
return ;
}
string aa = "";
string bb = "";
for(int i = 0;i < n;i ++)
{
if(a[i] == '.') aa += '#';
else aa +='.';
}
for(int i = 0;i < n;i ++)
{
if(b[i] == '.') bb += '#';
else bb +='.';
}
cout << "Yes" << endl;
cout << a << endl;
cout << aa << endl;
cout << aa << endl;
string ans = "";
for(int i = 0;i < n;i ++)
{
if(aa[i] == '.' && bb[i] == '.') ans += '#';
else if(aa[i] == '.' && bb[i] == '#') ans += '#';
else ans += '.';
}
cout << ans << endl;
cout << bb << endl;
cout << bb << endl;
cout << b << endl;
}
int main()
{
ios :: sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
cin >> t;
while(t --)
{
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Dangerous Syscalls
input:
5 4 #..# .##. 5 ##.#. .#.## 6 ###### .####. 27 .######.######.####.#.##### .####...####..#.......##### 10 ########## ##########