# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
586368 | hibiki | Lightning Rod (NOI18_lightningrod) | C++11 | 2012 ms | 166340 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 pb push_back
#define f first
#define s second
stack<int> s;
vector<pair<int,int> > v;
int main()
{
int n;
scanf("%d",&n);
for(int i = 0; i < n; i++)
{
int x, y;
scanf("%d %d",&x,&y);
v.pb({x,y});
while(!s.empty() && x - v[s.top()].f <= abs(y - v[s.top()].s) && y > v[s.top()].s)
s.pop();
if(s.empty() || x - v[s.top()].f > abs(y - v[s.top()].s))
s.push(i);
}
printf("%d\n",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... |