Submission #896210

#TimeUsernameProblemLanguageResultExecution timeMemory
8962108pete8Lightning Rod (NOI18_lightningrod)C++17
21 / 100
1134 ms192704 KiB
#include<iostream> #include<stack> #include<map> #include<vector> #include<string> #include<unordered_map> #include <queue> #include<cstring> #include<float.h> #include<limits.h> #include <cassert> #include<cmath> #include<set> #include<algorithm> #include <iomanip> #include<numeric> //gcd(a,b) #include<bitset> using namespace std; #define ll long long #define f first #define endl "\n" #define s second #define pii pair<int,int> #define ppii pair<int,pii> #define vi vector<int> #define pb push_back #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define F(n) for(int i=0;i<n;i++) #define lb lower_bound #define ub upper_bound #define fastio ios::sync_with_stdio(false);cin.tie(NULL); #pragma GCC optimize ("03,unroll-loops") using namespace std; //#define int long long #define double long double const int mod=998244353,mxn=1e6,lg=22;//inf=1e18,minf=-1e18,Mxn=100000; bool under(int x1,int y1,int x2,int y2){ if(y2-abs(x2-x1)>=y1)return true; return false; } int32_t main(){ fastio int n;cin>>n; stack<pii>st; for(int i=0;i<n;i++){ int a,b;cin>>a>>b; if(!st.empty()&&under(st.top().f,st.top().s,a,b))st.pop(); if(st.empty()||!under(a,b,st.top().f,st.top().s))st.push({a,b}); } 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...