forked from dharmanshu1921/porject
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmetaHackercupB1.cpp
More file actions
43 lines (43 loc) · 808 Bytes
/
Copy pathmetaHackercupB1.cpp
File metadata and controls
43 lines (43 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,m;
char arr[101][101];
void dxcs() {
cin >> n >> m;
bool flag=false,flag1=false;;
for(int i=1;i<=n;++i)
for(int j=1;j<=m;++j) {
cin >> arr[i][j];
if(arr[i][j]=='.') flag=true;
if(arr[i][j]=='^') flag1=true;
}
if(n==1||m==1) {
if(flag&&flag1) {
puts("Impossible");
return;
} else {
puts("Possible");
for(int i=1;i<=n;++i) {
for(int j=1;j<=m;++j)
cout << arr[i][j];
cout << endl;
}
return;
}
}
puts("Possible");
for(int i=1;i<=n;++i) {
for(int j=1;j<=m;++j)
putchar('^');
putchar('\n');
}
}
signed main() {
int T;
cin >> T;
for(int i=1;i<=T;++i) {
cout << "Case #" << i << ": ";
dxcs();
}
}