Submission #692858

#TimeUsernameProblemLanguageResultExecution timeMemory
692858saayan007Lightning Rod (NOI18_lightningrod)C++17
40 / 100
2084 ms167204 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using pi = pair<int, int>; using pl = pair<ll, ll>; using vi = vector<int>; using vl = vector<ll>; using vpi = vector<pi>; using vpl = vector<pl>; #define fur(i, a, b) for(ll i = a; i <= (ll) b; ++i) #define ruf(i, a, b) for(ll i = a; i >= (ll) b; --i) #define fr first #define sc second #define mp make_pair #define pb push_back #define eb emplace_back #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define nl "\n" int main() { ios_base::sync_with_stdio(0); cin.tie(0); ll n; cin >> n; #define x first #define y second pl a[n + 1]; fur(i, 1, n) { cin >> a[i].x >> a[i].y; } sort(a + 1, a + n + 1); bool covered[n + 1] = {}; fur(i, 1, n) { fur(j, 1, n) { if(i != j) { if(abs(a[i].x - a[j].x) <= a[i].y - a[j].y) covered[j] = 1; } } } ll ans = n; fur(i, 1, n) { ans -= covered[i]; } cout << ans << nl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...