Submission #494524

#TimeUsernameProblemLanguageResultExecution timeMemory
494524blueLightning Rod (NOI18_lightningrod)C++17
100 / 100
1889 ms157220 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<int> P; int x[1+N], y[1+N]; cin >> x[1] >> y[1]; P.push_back(1); for(int i = 2; i <= N; i++) { cin >> x[i] >> y[i]; if(abs(x[i] - x[P.back()]) <= y[P.back()] - y[i]) continue; while(!P.empty() && abs(x[P.back()] - x[i]) <= y[i] - y[P.back()]) P.pop_back(); P.push_back(i); } 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...