QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#756016 | #9621. 连方 | ericmegalovania | AC ✓ | 6ms | 4176kb | C++20 | 1.8kb | 2024-11-16 18:44:26 | 2024-11-16 18:44:26 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
//#define ONLINE
#ifndef ONLINE
char DEBUG_BUFFER[1000];
#define debug(...) {sprintf(DEBUG_BUFFER,##__VA_ARGS__);\
cerr<<"\033[1;36m"<<DEBUG_BUFFER<<"\033[0;2m"<<"\033[0m";}
#else
#define debug(...) ;
#endif
using LL=long long;
using PII=pair<int,int>;
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(),(x).rend()
#define FAST_IO {ios::sync_with_stdio(false);cin.tie(nullptr);}
inline int read(){static int x; cin>>x; return x;}
inline LL readLL(){static LL x; cin>>x; return x;}
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
int n;
string s[7],all_s;
void work(const int& x,const int& y,const bool& _){
bool ok=0;
for(int i=0;i<n;i++){
s[x][i]='#'+'.'-s[y][i];
}
if(_){
if(s[x][0]=='#' && s[x][1]=='#'){
s[x][0]='.';
}
}
}
void solve(){
cin>>n>>s[0]>>s[6];
for(int i=1;i<6;i++){
s[i].assign(n,'.');
}
s[3][0]='#';
{
all_s.assign(n,'#');
int x=(s[0]==all_s);
int y=(s[6]==all_s);
if(x!=y){
cout<<"No\n";
return;
}
if(x && y){
cout<<"Yes\n";
for(int i=0;i<7;i++){
cout<<all_s<<"\n";
}
return;
}
}
{
bool ok=1;
for(int i=0;i<n && ok;i++){
if(s[0][i]+s[6][i]=='.'+'#');
else ok=0;
}
if(ok){
cout<<"Yes\n";
for(int i=0;i<6;i++){
cout<<s[0]<<"\n";
}
cout<<s[6]<<"\n";
return;
}
}
work(1,0,1);
work(5,6,1);
work(2,1,1);
work(4,5,1);
cout<<"Yes\n";
for(int i=0;i<7;i++){
cout<<s[i]<<"\n";
}
}
int main(){
FAST_IO;
for(int T=read();T--;) solve();
return 0;
}
/* stuff you should look for
* int overflow, array bounds
* special cases (n=1?)
* do smth instead of nothing and stay organized
* WRITE STUFF DOWN
* DON'T GET STUCK ON ONE APPROACH
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3736kb
input:
5 4 #..# .##. 5 ##.#. .#.## 6 ###### .####. 27 .######.######.####.#.##### .####...####..#.......##### 10 ########## ##########
output:
Yes #..# #..# #..# #..# #..# #..# .##. Yes ##.#. ..#.# .#.#. #.... .#.## #.#.. .#.## No Yes .######.######.####.#.##### #......#......#....#.#..... .######.######.####.#.##### #.......................... .####...####..#.......##### #....###....##.#######..... .####...####..#.......##### Yes ########...
result:
ok Correct.
Test #2:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
10000 6 .#..## ..#... 5 #..#. ##... 6 .###.# ...### 17 .####..#######..# ###########.##### 6 ..##.# #.##.# 25 #.##.##############.####. ####################.##.# 9 ##.#..##. ##..##### 6 .###.# ##.### 6 ###..# #.#### 25 #####################.#.# ######.################## 6 .#.### .##..# 6 ..#### #......
output:
Yes .#..## #.##.. .#..## #..... #.#... .#.### ..#... Yes #..#. .##.# #..#. #.... .#... ..### ##... Yes .###.# #...#. .###.# #..... #..### .##... ...### Yes .####..#######..# #....##.......##. .####..#######..# #................ .##########.##### ...........#..... ###########.##### Yes ..##.# .#..#. ...
result:
ok Correct.
Test #3:
score: 0
Accepted
time: 3ms
memory: 3716kb
input:
10000 41 #######.#######.######################### ################.###.#######.############ 6 ..#..# #..##. 6 #.#... #...#. 6 .#.##. ....## 6 ...#.# ##..#. 33 #####.########################### ###########.##################### 6 .##.## .##.#. 5 ..##. ####. 17 #.###.##########. ####.##.#####.##. 5 ....
output:
Yes #######.#######.######################### .......#.......#......................... .######.#######.######################### #........................................ .###############.###.#######.############ ................#...#.......#............ ################.###.#######.############ Ye...
result:
ok Correct.
Test #4:
score: 0
Accepted
time: 6ms
memory: 3796kb
input:
10000 6 ..#### .#.... 6 ...#.# #..##. 9 ..####.## ######..# 33 #######################.#####..## ######.######.###########.####### 6 ####.# #..##. 6 ...### ##.### 25 ######.#.#.############## .#########.##########.### 17 ############.#### ###############.# 6 #..#.# #####. 6 .#.### ..#... 49 ########...
output:
Yes ..#### .#.... #.#### #..... .#.... #.#### .#.... Yes ...#.# .##.#. #..#.# #..... #..##. .##..# #..##. Yes ..####.## .#....#.. #.####.## #........ .#####..# ......##. ######..# Yes #######################.#####..## .......................#.....##.. .######################.#####..## #................
result:
ok Correct.
Test #5:
score: 0
Accepted
time: 6ms
memory: 3792kb
input:
10000 5 ...#. ##### 6 ###... ##..#. 9 .#.###### #.#..#### 49 ######.########################################## ########.#############.########################## 41 ###########.#######.##################### ##############.########################## 6 ###..# ###.## 49 #################################...
output:
No Yes ###... ...### .##... #..... .#..#. ..##.# ##..#. Yes .#.###### #.#...... .#.###### #........ #.#..#### .#.##.... #.#..#### Yes ######.########################################## ......#.......................................... .#####.########################################## #..................
result:
ok Correct.
Test #6:
score: 0
Accepted
time: 2ms
memory: 4168kb
input:
2 100000 ###.#...#..####...#####..####.#.######.##.##..#..#..####...###.#..##.#.##.####.#.#.###...#.##...####.#.#.####...####.#..##.##.#.#.....####..####..#...#..#.##..#.##.#.....#..#.#.###.#....####...####..##.#.#####..####.##.#.###.#.#....#.##.##...#.######.#..##..##...#.....#....#.####...#...##.#...
output:
Yes ###.#...#..####...#####..####.#.######.##.##..#..#..####...###.#..##.#.##.####.#.#.###...#.##...####.#.#.####...####.#..##.##.#.#.....####..####..#...#..#.##..#.##.#.....#..#.#.###.#....####...####..##.#.#####..####.##.#.###.#.#....#.##.##...#.######.#..##..##...#.....#....#.####...#...##.##.#.....
result:
ok Correct.
Test #7:
score: 0
Accepted
time: 2ms
memory: 4176kb
input:
2 100000 ##.####.#..#..#.##..#.#..###..##..#####.....#..##.##.#...#.###..##..#...##...####..#...##...##.......#.#..##.##..###.#.###.##.#########..#...###.####.##...#..#.....#####.....#.####.#####..#.#....#..###.#.##..#..#.##.......#.###.##...####.....######..#.##....#.#.###.#.###.#..#.....####....##...
output:
Yes ##.####.#..#..#.##..#.#..###..##..#####.....#..##.##.#...#.###..##..#...##...####..#...##...##.......#.#..##.##..###.#.###.##.#########..#...###.####.##...#..#.....#####.....#.####.#####..#.#....#..###.#.##..#..#.##.......#.###.##...####.....######..#.##....#.#.###.#.###.#..#.....####....##........
result:
ok Correct.