Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
36019 23级逯一鸣 【S】T1 C++ 编译错误 0 0 MS 0 KB 1131 2025-02-07 14:17:18

Tests(0/0):


#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, [](auto x, auto y) { return x < queried(y); }) - lower_bound(arr.begin(), arr.end(), l, [](auto x, auto y) { return queried(x) < y; }) << '\n'; return 0; }


测评信息: