mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-18 20:52:00 +00:00
40 lines
742 B
C++
40 lines
742 B
C++
#include <iostream>
|
|
#include <map>
|
|
|
|
using std::cin;
|
|
using std::cout;
|
|
const char endl = '\n';
|
|
|
|
const int N = 2e5 + 5;
|
|
|
|
int n;
|
|
int a[N], b[N], c[N];
|
|
|
|
std::map<int, int> map;
|
|
|
|
signed main() {
|
|
std::ios::sync_with_stdio(false);
|
|
cin >> n;
|
|
for (int i = 1; i <= n; i++) {
|
|
cin >> a[i] >> b[i];
|
|
map[b[i]] = 1e9 + 5;
|
|
}
|
|
for (int i = 1; i <= n; i++) {
|
|
char op;
|
|
cin >> op;
|
|
if (op == 'R') {
|
|
map[b[i]] = std::min(map[b[i]], a[i]), c[i] = 1;
|
|
}
|
|
}
|
|
for (int i = 1; i <= n; i++) {
|
|
if (!c[i]) {
|
|
if (map[b[i]] <= a[i]) {
|
|
cout << "Yes" << endl;
|
|
exit(0);
|
|
}
|
|
}
|
|
}
|
|
cout << "No" << endl;
|
|
return 0;
|
|
}
|