Submission #494523

#TimeUsernameProblemLanguageResultExecution timeMemory
494523blueLightning Rod (NOI18_lightningrod)C++17
100 / 100
1890 ms229500 KiB
#include <iostream> #include <vector> #include <cmath> #include <cstdlib> #include <algorithm> using namespace std; using pii = pair<int, int>; #define sz(x) int(x.size()) int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int N; cin >> N; vector<pii> P; int u, v; cin >> u >> v; P.push_back({u, v}); for(int i = 2; i <= N; i++) { int x, y; cin >> x >> y; if(abs(x - P.back().first) <= P.back().second - y) continue; while(!P.empty() && abs(P.back().first - x) <= y - P.back().second) P.pop_back(); P.push_back({x, y}); } cout << sz(P) << '\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...