-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA.cpp
62 lines (49 loc) · 1.24 KB
/
A.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include <algo/debug.h>
#else
#define debug(...) void(31)
#endif
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for (int i = (int)a; i <= (int)b; ++i)
#define FORD(i, b, a) for (int i = (int)b; i >= (int)a; --i)
#define EACH(v, a) for (auto& v : a)
#define SZ(a) ((int) a.size())
using ll = long long;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
int main() {
#ifdef LOCAL
freopen("inp/A1.in", "r", stdin);
#endif
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<ll> x(n), y(n), t(n);
ll curX = 0, curY = 0, curT = 0;
bool isOK = true;
REP(i, n) {
cin >> x[i] >> y[i] >> t[i];
ll d = abs(x[i] - curX) + abs(y[i] - curY);
ll distT = t[i] - curT;
if (distT < d) {
isOK = false;
break;
}
// distT >= d
curX = x[i];
curY = y[i];
curT = t[i];
debug(curX, curY, curT);
}
cout << (isOK ? "YES" : "NO") << endl;
}