-
Notifications
You must be signed in to change notification settings - Fork 0
/
180_A. Snow Footprints.cpp
51 lines (47 loc) · 992 Bytes
/
180_A. Snow Footprints.cpp
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
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define nn "\n"
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
void solve()
{
string str;
int n;
cin>>n>>str;
int check1 = 0;
int check2 = 0;
int s = 0,t = 2000;
for(ll i = 0;i<n;i++){
if(str[i]=='L'&&check1==0){
check1 = 1;
t = i-1+1;
}
else if(str[i]=='.'&& check1==1){
s = i-1+1;
break;
}
if(str[i]=='R'&&check2==0){
check2 = 1;
s = i+1;
}
else if(str[i]=='L' && check2 ==1){
t = i;
break;
}
else if(str[i] == '.' &&check2 ==1){
t = i+1;
break;
}
}
cout<<s<<' '<<t<<nn;
}
int main()
{
fastio();
int t=1;
//cin>>t;
while(t--) {
solve();
}
return 0;
}