0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-10 00:18:48 +00:00

C - Collision 2

https://atcoder.jp/contests/abc243/submissions/30053743
This commit is contained in:
Baoshuo Ren 2022-03-12 20:38:35 +08:00
parent 126dfda591
commit 573d0bffbd
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

39
AtCoder/ABC243/C/C.cpp Normal file
View File

@ -0,0 +1,39 @@
#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;
}