Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
#include
#include
#include
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
> 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 **/
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)