# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
363591 | keta_tsimakuridze | Lightning Rod (NOI18_lightningrod) | C++14 | 2074 ms | 53612 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>
#define f first
#define s second
using namespace std;
const int N=1e7+5,mod=1e9+7;
int t,x[N],y[N],n;
stack<int> s;
main(){
t=1;
// cin >> t;
while(t--){
cin>>n;
for(int i=1;i<=n;i++){
cin>>x[i]>>y[i];
while(s.size() && x[s.top()]-y[s.top()]>=x[i]-y[i]) s.pop();
if(!s.size() || x[s.top()]+y[s.top()]<x[i]+y[i]) s.push(i);
}
cout<<s.size();
}
}
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... |