# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
138934 | thebes | Lightning Rod (NOI18_lightningrod) | C++14 | 2069 ms | 81208 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.
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,ssse3,sse3,sse4,popcnt,avx,mmx,abm,tune=native")
#include <bits/stdc++.h>
using namespace std;
stack<pair<int,int>> mono;
int n, i, x, y, f;
int main(){
for(scanf("%d",&n),i=1;i<=n;i++){
scanf("%d%d",&x,&y); f=0;
while(mono.size()){
if(x-mono.top().first<=mono.top().second-y) break;
else if(y-mono.top().second>=x-mono.top().first) mono.pop();
else{f=1; break;}
}
if(mono.empty()||f) mono.push({x,y});
}
printf("%d\n",mono.size());
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... |