Submission #924124

#TimeUsernameProblemLanguageResultExecution timeMemory
924124pccLightning Rod (NOI18_lightningrod)C++14
100 / 100
1364 ms229296 KiB
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,popcnt,sse4") #define ll long long #define pll pair<ll,ll> #define pii pair<int,int> #define fs first #define sc second #define tlll tuple<ll,ll,ll> const int mxn = 1e7+10; pii arr[mxn]; int N; vector<int> st; inline bool cover(pii &a,pii &b){ if(a.fs < b.fs){ return a.sc-a.fs<=b.sc-b.fs; } else return a.sc+a.fs<=b.sc+b.fs; } int main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>N; for(int i = 0;i<N;i++){ cin>>arr[i].fs>>arr[i].sc; } for(int i = 0;i<N;i++){ while(!st.empty()&&cover(arr[st.back()],arr[i]))st.pop_back(); if(st.empty()||!cover(arr[i],arr[st.back()]))st.push_back(i); } cout<<st.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...