Submission #743793

#TimeUsernameProblemLanguageResultExecution timeMemory
743793vjudge1Lightning Rod (NOI18_lightningrod)C++17
100 / 100
424 ms79824 KiB
#include<bits/stdc++.h> using namespace std; int n,x,y; stack<pair<int, int>> s; inline void read(int &x) { x = 0; char ch = getchar_unlocked(); while (ch & 16) { x = (x << 3) + (x << 1) + (ch & 15); ch = getchar_unlocked(); } } int main() { ios_base::sync_with_stdio(0),cin.tie(0); read(n); for(int i = 0; i<n; ++i){ read(x); read(y); if(!s.empty() && abs(s.top().first-x)<=s.top().second-y){ continue; } while(!s.empty() && abs(x-s.top().first)<=y-s.top().second) s.pop(); s.push({x,y}); } cout<<s.size(); }
#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...