# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
265318 | T0p_ | Lightning Rod (NOI18_lightningrod) | C++14 | 2077 ms | 61596 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;
pair<int, int> arr[10000005];
int main()
{
int n, now = 0;
scanf(" %d",&n);
while(n--)
{
int x, y;
scanf(" %d %d",&x,&y);
if(now == 0) arr[++now] = {x, y};
else
{
int h = arr[now].second - x + arr[now].first;
if(h >= y) continue ;
int l = 1, r = now;
while(l != r)
{
int mid = (l+r+1)>>1;
int h = y - x + arr[mid].first;
if(h >= arr[mid].second) r = mid-1;
else l = mid;
}
now = l;
arr[++now] = {x, y};
}
}
printf("%d\n",now);
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... |