#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <cmath>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <unordered_map>
using namespace std;
#define int long long
#define MOD 1000000007
#define INF 2000000000
#define IN 100001
#define LOG 17
#define MINF -2000000000
#define all(x) x.begin(),x.end()
#define ios ios_base::sync_with_stdio(0);cin.tie(0);
void solution(){
int n,m; cin >> n >> m;
vector<string> arr(n);
for(int i = 0; i < n; i++){
cin >> arr[i];
}
int ans = -1;
bool ok = false;
bool ch = false;
for(int i = 0; i < n; i++){
int cnt = 0;
for(int j = 0; j < m; j++){
if(arr[i][j] == 'R') ok = true;
if(arr[i][j] == 'F') ch = true;
if(j == 0){
if(arr[i][j] != '.') cnt++;
}else{
if(arr[i][j] != arr[i][j-1] && arr[i][j-1] == '.') cnt++;
}
}
ans = max(ans , cnt);
}
// cout << ok << " " << ch << endl;
if(ok == true && ch == true) cout << ans+1 << endl;
else cout << ans << endl;
}
signed main(){
ios
int t = 1;
// cin >> t;
while(t--){
solution();
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
856 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
604 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
604 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
604 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
604 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
15 |
Incorrect |
2 ms |
860 KB |
Output isn't correct |
16 |
Incorrect |
2 ms |
860 KB |
Output isn't correct |
17 |
Incorrect |
2 ms |
860 KB |
Output isn't correct |
18 |
Incorrect |
1 ms |
604 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
604 KB |
Output isn't correct |
2 |
Incorrect |
10 ms |
3420 KB |
Output isn't correct |
3 |
Incorrect |
80 ms |
33876 KB |
Output isn't correct |
4 |
Incorrect |
16 ms |
7992 KB |
Output isn't correct |
5 |
Incorrect |
29 ms |
19120 KB |
Output isn't correct |
6 |
Incorrect |
80 ms |
33900 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
604 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
604 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
360 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
616 KB |
Output isn't correct |
12 |
Incorrect |
0 ms |
360 KB |
Output isn't correct |
13 |
Incorrect |
9 ms |
3432 KB |
Output isn't correct |
14 |
Incorrect |
5 ms |
2472 KB |
Output isn't correct |
15 |
Incorrect |
5 ms |
2408 KB |
Output isn't correct |
16 |
Incorrect |
4 ms |
1760 KB |
Output isn't correct |
17 |
Incorrect |
21 ms |
8764 KB |
Output isn't correct |
18 |
Incorrect |
20 ms |
8552 KB |
Output isn't correct |
19 |
Incorrect |
17 ms |
7868 KB |
Output isn't correct |
20 |
Incorrect |
18 ms |
7492 KB |
Output isn't correct |
21 |
Incorrect |
47 ms |
19476 KB |
Output isn't correct |
22 |
Incorrect |
28 ms |
18920 KB |
Output isn't correct |
23 |
Incorrect |
41 ms |
16368 KB |
Output isn't correct |
24 |
Incorrect |
44 ms |
19024 KB |
Output isn't correct |
25 |
Incorrect |
84 ms |
34180 KB |
Output isn't correct |
26 |
Correct |
39 ms |
25848 KB |
Output is correct |
27 |
Incorrect |
55 ms |
33612 KB |
Output isn't correct |
28 |
Incorrect |
66 ms |
33876 KB |
Output isn't correct |
29 |
Incorrect |
70 ms |
34124 KB |
Output isn't correct |
30 |
Incorrect |
58 ms |
33192 KB |
Output isn't correct |
31 |
Incorrect |
74 ms |
21648 KB |
Output isn't correct |
32 |
Incorrect |
53 ms |
33616 KB |
Output isn't correct |