# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
426519 | Amylopectin | Lightning Rod (NOI18_lightningrod) | C++14 | 2103 ms | 72548 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 <iostream>
//#include <stdio.h>
//#include <stdlib.h>
#include <bits/stdc++.h>
using namespace std;
const int mxn = 2e7 + 10;
struct we
{
int xx,yy;
};
struct we a[mxn] = {};
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int i,j,n,m,ru = -1,cx,cy;
cin >> n;
// scanf("%d",&n);
for(i=0; i<n; i++)
{
cin >> cx >> cy;
// if(ru == -1)
// {
// ru ++;
// a[ru] = {cx,cy};
// continue;
// }
// scanf("%d %d",&cx,&cy);
// if(cx - a[ru].xx <= a[ru].yy - cy)
// {
//// ru ++;
//// a[ru] = {cx,cy};
// continue;
// }
// while(ru >= 0 && cx - a[ru].xx <= cy - a[ru].yy)
// {
// ru --;
// }
// if(ru == -1 || cx - a[ru].xx > a[ru].yy - cy)
// {
// ru ++;
// a[ru] = {cx,cy};
// }
while(ru >= 0 && cx - a[ru].xx <= cy - a[ru].yy)
{
ru --;
}
if(ru == -1 || cx - a[ru].xx > a[ru].yy - cy)
{
ru ++;
a[ru] = {cx,cy};
}
}
cout << ru + 1 << "\n";
// printf("%d\n",ru + 1);
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... |