intfind(int x) { int l = 0, r = alls.size() - 1; while (l < r) { int mid = l + r >> 1; if (alls[mid] >= x) r = mid; // 注意一定要是≥x else l = mid + 1; } return r + 1; // s[]下标从1开始 }
vector<int>::iterator unique(vector<int> &a) { int j = 0; for (int i = 0; i < a.size(); i ++ ) if (!i || a[i] != a[i - 1]) a[j ++ ] = a[i]; // a[0] ~ a[j - 1] 所有a中不重复的数
return a.begin() + j; }
intmain() { cin >> n >> m; for (int i = 0; i < n; i ++ ) { int x, c; cin >> x >> c; add.push_back({x, c});
alls.push_back(x); }
for (int i = 0; i < m; i ++ ) { int l, r; cin >> l >> r; query.push_back({l, r});