# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
416255 | strawberry2005 | Lightning Rod (NOI18_lightningrod) | C++17 | 2033 ms | 191248 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define nl '\n'
const int mod = 1e9+7;
#define deb(x) cout<<#x<<": "<<x<<endl
int iceil(int a, int b) {
return (a + b - 1) / b;
}
int mod_fun(int a, int mod){
while(a < 0) a += mod;
return a % mod;
}
signed main(){
#ifdef strawberryshaker2005
freopen("input.txt", "r", stdin);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin>>n;
stack<pair<int,int>> s;
for(int i=0;i<n;i++){
int x,y,add=0;
cin>>x>>y;
while(!s.empty()&&abs(x-s.top().F)<=abs(y-s.top().S)){
s.pop();
}
s.push({x,y});
}
cout<<s.size();
return(0);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |