| #include <bits/stdc++.h> | |
| #define alive std::cout << "$LINE @" << __LINE__ << " ALIVE" << std::endl | |
| #define watch(var) std::cout << "$ LINE @" << __LINE__ << " FUN @" << __FUNCTION__ \ | |
| << " VAR @" << (#var) << ": " << (var) << std::endl | |
| using namespace std; | |
| typedef int i32; | |
| typedef unsigned int u32; | |
| typedef long long i64; | |
| typedef unsigned long long u64; | |
| typedef double f64; | |
| typedef long double f128; | |
| typedef pair<int, int> pii; | |
| template <typename Tp> | |
| inline void read(Tp &x) | |
| { | |
| x = 0; | |
| bool neg = false; | |
| char c = getchar(); | |
| for (; !isdigit(c); c = getchar()) | |
| { | |
| if (c == '-') | |
| { | |
| neg = true; | |
| } | |
| } | |
| for (; isdigit(c); c = getchar()) | |
| { | |
| x = x * 10 + c - '0'; | |
| } | |
| if (neg) | |
| { | |
| x = -x; | |
| } | |
| } | |
| const int M = 1e5 + 5; | |
| int main() | |
| { | |
| int n, w, u, v, s, e; | |
| read(n), read(w), read(u), read(v), read(s), read(e); | |
| const f64 W = (f64)w, U = (f64)u, V = (f64)v, S = (f64)s, E = (f64)e; | |
| vector<pair<f64, int>> vec; | |
| vec.reserve(M); | |
| vec.emplace_back(S, 0); | |
| vec.emplace_back(E, 0); | |
| char op[5]; | |
| f64 L, R; | |
| for (int i = 0, dir, m; i < n; ++i) | |
| { | |
| scanf("%s", op); | |
| dir = (op[0] == 'W') ? 1 : -1; | |
| read(m); | |
| for (int k = 0, l, p; k < m; ++k) | |
| { | |
| read(l), read(p); | |
| L = std::max((f64)dir * (f64)p / U - W * (f64)(i + 1) / V, S); | |
| R = std::min(((f64)dir * (f64)p + (f64)l) / U - W * (f64)i / V, E); | |
| if (L <= E && R >= S) | |
| { | |
| vec.emplace_back(L, 1); | |
| vec.emplace_back(R, -1); | |
| } | |
| } | |
| } | |
| sort(vec.begin(), vec.end()); | |
| f64 ans = 0.0; | |
| int cur = 0; | |
| for (size_t i = 0UL, len = vec.size() - 1UL; i < len; ++i) | |
| { | |
| cur += vec[i].second; | |
| if (cur == 0) | |
| { | |
| ans = std::max(ans, vec[i + 1UL].first - vec[i].first); | |
| } | |
| } | |
| printf("%.8f\n", ans); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment