?
# | Author | Problem | Lang | Verdict | Time | Memory | Sent | Judged | |
---|---|---|---|---|---|---|---|---|---|
188546347 |
Practice: DaiRuiChen007 |
1495C - 26 | C++14 (GCC 6-32) | Accepted | 108 ms | 252 KB | 2023-01-09 08:56:29 | 2023-01-09 08:56:29 |
// LUOGU_RID: 99117338 #include<bits/stdc++.h> using namespace std; const int MAXN=501; char a[MAXN][MAXN]; inline void solve() { int n,m; cin>>n>>m; for(int i=1;i<=n;++i) { for(int j=1;j<=m;++j) { cin>>a[i][j]; } } for(int i=1;i<=n;i+=3) { for(int j=1;j<=m;++j) a[i][j]='X'; if(i==n||i+1==n) break; if(i+2==n) { for(int j=1;j<=m;++j) if(a[i+2][j]=='X') a[i+1][j]='X'; break; } for(int j=1;j<=m;++j) { if(a[i+1][j]=='X'||a[i+2][j]=='X') { a[i+1][j]=a[i+2][j]='X'; goto Connected; } } a[i+1][1]=a[i+2][1]='X'; Connected:; } for(int i=1;i<=n;++i) { for(int j=1;j<=m;++j) { cout<<a[i][j]; } cout<<"\n"; } } signed main() { int T; cin>>T; while(T--) solve(); return 0; }
?
?
?
?