Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
36020 | 23级逯一鸣 | 【S】T1 | C++ | 通过 | 100 | 150 MS | 12700 KB | 1127 | 2025-02-07 14:17:39 |
#include <algorithm> #include <iostream> #include <tuple> #include <vector> using namespace std; using i64 = long long; vector<tuple<int, i64, int, int>> query; inline i64 queried(i64 v) { for (const auto& each : query) { i64 x = get<1>(each); int op = get<0>(each), s = get<2>(each), t = get<3>(each); if (op == 1 && v >= x) v = (v + s) * t; else if (op == 2 && v <= x) v = (v - s) / t; } return v; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); i64 l, r; int n, q; cin >> n >> q >> l >> r; vector<i64> arr(n); for (auto& x : arr) cin >> x; while (q-- > 0) { i64 x; int op, s, t; cin >> op >> x >> s >> t; query.emplace_back(op, x, s, t); } sort(arr.begin(), arr.end()); cout << upper_bound(arr.begin(), arr.end(), r, [](i64 x, i64 y) { return x < queried(y); }) - lower_bound(arr.begin(), arr.end(), l, [](i64 x, i64 y) { return queried(x) < y; }) << '\n'; return 0; }