-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgreetings.cpp
36 lines (31 loc) · 862 Bytes
/
greetings.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
#include <bits/stdc++.h>
using namespace std;
int b, e, pos_b, pos_e, ans;
vector <int> stack_b;
vector <int> stack_e;
int main(){
freopen("greetings.in", "r", stdin);
freopen("greetings.out", "w", stdout);
int temp_int;
string temp_string;
scanf("%d%d", &b, &e);
for (int i = 0; i < b; ++i){
scanf("%d", &temp_int);
cin >> temp_string;
if (temp_string[0] == 'L') temp_int = -1 * temp_int;
stack_b.push_back(temp_int);
}
for (int i = 0; i < e; ++i){
scanf("%d", &temp_int);
cin >> temp_string;
if (temp_string[0] == 'L') temp_int = -1 * temp_int;
stack_e.push_back(temp_int);
}
for (int i = 0; i < min(b, e); ++i){
int check = pos_b - pos_e;
pos_b += stack_b[i];
pos_e += stack_e[i];
}
printf("%d", ans);
return 0;
}