Submission #865387

#TimeUsernameProblemLanguageResultExecution timeMemory
865387Trisanu_DasLightning Rod (NOI18_lightningrod)C++17
66 / 100
2047 ms40788 KiB
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second int n; stack<pair<int, int> > s; int main() { 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...