#include <bits/stdc++.h>
using namespace std;
#define int long long
// #define endl '\n'
#define ff first
#define ss second
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define arr array
const int MOD = 1e9 + 7,INF = 1e18, N = 2e5 + 5;
/*
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
3
1 3 2
3
1 3 3
3
1 3 4
3
1 4 1
3
1 4 2
3
1 4 3
3
1 4 4
3
2 1 1
3
2 1 2
3
2 1 3
3
2 1 4
3
2 2 1
3
2 2 2
3
2 2 3
3
2 2 4
3
2 3 1
3
2 3 2
3
2 3 3
3
2 3 4
3
2 4 1
3
2 4 2
3
2 4 3
3
2 4 4
*/
void solve(){
int n , m;
cin >> n >> m;
vector <string> a(n);
for(int i = 0;i < n;i++){
cin >> a[i];
}
int cnt1 = 0, cnt2 = 0;
for(int i = 0;i < n;i++){
for(int j = 0;j < m;j++){
if(a[i][j] == 'F'){
cnt1++;
}
else if(a[i][j] == 'R'){
cnt2++;
}
}
}
if(!cnt1 && !cnt2){
cout<<"0";
}
else if(cnt1 && cnt2){
cout<<"2";
}
else{
cout<<"1";
}
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int ti = 1;
// cin >> ti;
while (ti--) {
solve();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |