Submission #954691

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9546912024-03-28 11:09:09WarinchaiAdvertisement 2 (JOI23_ho_t2)C++14
0 / 100
1 ms456 KiB
#include<bits/stdc++.h>
using namespace std;
vector<pair<int,int>>v;
bool check(pair<int,int>f,pair<int,int>s){
return abs(f.first-s.first)<=f.second-s.second;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;cin>>n;
int a,b;
for(int i=1;i<=n;i++){
cin>>a>>b;
v.push_back({a,b});
}
stack<pair<int,int>>st;
st.push(v[0]);
for(int i=1;i<n;i++){
a=v[i].first;
b=v[i].second;
if(!check(st.top(),v[i])){
while(!st.empty()&&check(v[i],st.top())){
st.pop();
}
st.push(v[i]);
}
}
cout<<st.size();
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...