-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path1680B
More file actions
54 lines (44 loc) · 924 Bytes
/
1680B
File metadata and controls
54 lines (44 loc) · 924 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
44
45
46
47
48
49
50
51
52
53
54
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define debug(x) cout<<"[" << #x << " is:" << x << "] "<<endl;
#define endl '\n'
//By: Tamim
void solve() {
int n,m;
cin >> n >> m;
char a[n][m];
int l = 0,r = 0;
bool f = false;
bool ans = true;
for(int i =0 ; i < n ; i++){
for(int j = 0 ; j < m ; j++){
cin >> a[i][j];
if(a[i][j] == 'R' && !f){
l = i,r = j;
f = true;
}
else if(a[i][j] == 'R' && f){
if(i < l || j < r){
ans = false;
}
}
}
}
if(ans){
cout << "YES" << endl;
}
else{
cout << "NO" << endl;
}
}
int32_t main() {
ios::sync_with_stdio(false);cin.tie(0);
cout.tie(0);
int t =1 ;
cin >>t;
while (t--) {
solve();
}
return 0;
}