# |
Author |
Problem |
Lang |
Verdict |
Time |
Memory |
Sent |
Judged |
|
154398019 |
Out of competition:
* AnasMaged |
1669G
- 12
|
C++17 (GCC 7-32)
|
Skipped
|
31 ms
|
4 KB
|
2022-04-21 19:04:35 |
2022-04-22 09:14:13 |
|
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t ;
cin >> t ;
while(t--){
int n , m ;
cin >> n >> m ;
char a[n][m] ;
for(int i = 0 ; i < n ; i++){
for(int j = 0 ; j < m ; j++){
cin >> a[i][j] ;
}
}
for(int j = 0 ; j < m ; j++){
int cnt = 0 ;
for(int i = 0 ; i < n ; i++){
if(a[i][j] == '*'){
cnt++ ;
a[i][j] = '.' ;
}
else if(a[i][j] == 'o'){
int k = i - 1 ;
while(cnt > 0){
a[k][j] = '*' ;
cnt--;
k-- ;
}
}
if(i == n - 1){
int k = i ;
while(cnt > 0){
a[k][j] = '*' ;
cnt-- ;
k-- ;
}
}
}
}
for(int i = 0 ; i < n ; i++){
for(int j = 0 ; j < m ; j++){
cout << a[i][j] ;
}
cout << "\n" ;
}
}
return 0;
}
Click to see test details