Submission #865389

#TimeUsernameProblemLanguageResultExecution timeMemory
865389Trisanu_DasLightning Rod (NOI18_lightningrod)C++17
100 / 100
1343 ms178044 KiB
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second int n; stack<pair<int, int> > s; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n; for (int i = 1; i <= n; i++) { int x, y; cin >> x >> y; int mx = x + y, mn = x - y; while(!s.empty() && s.top().ff >= mn) s.pop(); if(s.empty() || s.top().ss < mx) s.push({mn, mx}); } cout << s.size() << '\n'; }
#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...