# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
361719 | wildturtle | Lightning Rod (NOI18_lightningrod) | C++14 | 2068 ms | 73884 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;
int a,b,c,d,n;
bool l;
stack < pair <int , int > > st;
int main() {
//ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
scanf ("%d",&n);
for(int i=1;i<=n;i++) {
scanf ("%d",&a);
scanf ("%d",&b);
l=0;
while(!st.empty()) {
c=st.top().first;
d=st.top().second;
if(a+b<=c+d) { l=1; break; }
if(a-b<=c-d) st.pop();
else break;
}
if(l==0) st.push({a,b});
}
cout<<st.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... |