Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <cstring>
- #include <fstream>
- using namespace std;
- typedef long long ll;
- int main() {
- ios_base::sync_with_stdio(false);
- ifstream cin("input.txt");
- ll n, radius, range;
- cin >> n >> radius >> range;
- vector<pair<ll, ll> > v(n);
- for(int i = 0; i < n; i++) {
- cin >> v[i].first >> v[i].second;
- }
- sort(v.begin(), v.end());
- ll result = 0;
- // cout << v[0].first << endl;
- // cout << v[n - 1].first << endl;
- for(int i = 0; i < n; i++) {
- ll extends = v[i].first + (2 * radius);
- ll take = (v[i].second + range - 1) / range;
- // cout << extends << " "<< v[i + 5].first << endl;
- // break;
- int j = i + 1;
- while(j < n and extends >= v[j].first) {
- take = max((v[j].second + range - 1) / range, take);
- j++;
- }
- // cout << i << " " << j << endl;
- i = j - 1;
- result += take;
- }
- cout << result << endl;
- return 0;
- }
- /*
- 4 1 1
- 7 1
- 8 1
- 9 1
- 10 1
- 302917175
- 641099008
- **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement