1 条题解
-
0

#include <bits/stdc++.h> using std::cin; using std::cout; typedef std::pair <int, int> pr; const int N = 10054; int n, t; int right[N]; int cur[N], f[N], forbid[N]; pr a[N]; inline void down(int &x, const int y) {x > y ? x = y : 0;} int main() { int i, l, r; std::ios::sync_with_stdio(false), cin.tie(NULL); cin >> n >> t; for (i = 0; i < n; ++i) cin >> l >> r, cur[i] = n - 1, a[i] = pr(l, right[i] = r); std::sort(a, a + n), std::sort(right, right + n), memset(forbid, 63, n << 2), memcpy(f, right, n << 2); for (l = n - 1; l >= 0; --l) for (r = n - 1; right[r] >= a[l].second; --r) { int &j = cur[r]; for (f[r] -= t; l < j && f[r] < a[j].first; --j) down(f[r], forbid[j]); if (f[r] < a[l].first) return cout << "no\n", 0; down(forbid[l], f[r] - t); } return cout << "yes\n", 0; }
- 1
信息
- ID
- 6624
- 时间
- 6000ms
- 内存
- 1024MiB
- 难度
- 10
- 标签
- 递交数
- 2
- 已通过
- 1
- 上传者