# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
373043 | sam571128 | Planine (COCI21_planine) | C++14 | 264 ms | 49724 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>
#define int long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int N = 1e6+5;
const double EPS = 1e-7;
pair<double,double> seg[N];
int st[N], id[N];
int n, h;
double findp(int x1, int y1, int x2, int y2){
assert(y1!=y2);
return 1.0*(h-y1)*(x2-x1)/(y2-y1)+x1;
}
signed main(){
fastio
//freopen("input.in","r",stdin);
cin >> n >> h;
vector<pair<double,double>> v(1);
for(int i = 1;i <= n;i++){
int x,y;
cin >> x >> y;
v.push_back({x,y});
}
for (int i = 3; i <= n; i+=2) {
seg[i].first = findp(v[i].first,v[i].second, v[i-1].first, v[i-1].second);
//cout << i << " " << seg[i].first << "\n";
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |