Submission #743995

#TimeUsernameProblemLanguageResultExecution timeMemory
743995vjudge1Lightning Rod (NOI18_lightningrod)C++17
0 / 100
1594 ms133768 KiB
#include<bits/stdc++.h> using namespace std; struct point { int x,y; }; int n; vector<point> vec; int cnt = 0; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; stack<point> st; for(int i=0;i<n;++i) { int a,b; cin >> a >> b; vec.push_back({a,b}); } for(int i=0;i<n;++i) { while(!st.empty() && vec[i].y-st.top().y >= st.top().x-vec[i].x) st.pop(); if(st.empty() || !(vec[i].y-st.top().y >= st.top().x-vec[i].x)) { // cout << "add " << vec[i].x << " " << vec[i].y << '\n'; st.push({vec[i].x,vec[i].y}); } } cout << st.size(); return 0; }
#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...