# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1101124 | vjudge1 | 로봇 (IOI13_robots) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define vc vector
#define vci vc<ll>
#define vcs vc<string>
#define pb push_back
#define ins insert
#define ii pair<ll,ll>
#define str to_string
#define fi first
#define se second
#define mii unordered_map<ll, ll>
#define len (ll)size
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
ll n;
cin >> n;
ll x, h;
ll bef = INT_MIN, res = 0, px = INT_MAX;
while(n--) {
cin >> x >> h;
if(x - h > bef) bef = x, res++;
else if(x > bef) bef = x + h, res++;
else if(x - h > px) bef = x;
else bef = x + h;
px = x;
}
cout << res << endl;
return 0;
}