# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
730033 |
2023-04-25T06:02:42 Z |
blue |
Planine (COCI21_planine) |
C++17 |
|
43 ms |
716 KB |
#include <bits/stdc++.h>
using namespace std;
#define sz(x) int(x.size())
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int N;
cin >> N;
double h;
cin >> h;
double x[1+N], y[1+N];
for(int i = 1; i <= N; i++)
{
cin >> x[i] >> y[i];
}
vector<double> lo, hi;
// cerr << "\n\n";
for(int i = 3; i < N; i += 2)
{
double sl1 = (y[i-1] - y[i])/(x[i] - x[i-1]);
lo.push_back(x[i] - (h - y[i])/sl1);
double sl2 = (y[i+1] - y[i])/(x[i+1] - x[i]);
hi.push_back(x[i] + (h - y[i])/sl2);
// cerr << sl1 << ' ' << sl2 << '\n';
cerr << lo.back() << ' ' << hi.back() << '\n';
}
int res = 1;
double clo, chi;
clo = lo[0];
chi = hi[0];
for(int i = 1; i < sz(lo); i++)
{
clo = max(clo, lo[i]);
chi = min(chi, hi[i]);
// cerr << i << " : " << clo << ' ' << chi << '\n';
if(chi < clo)
{
res++;
clo = lo[i];
chi = hi[i];
}
}
cout << res << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
43 ms |
716 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
320 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
43 ms |
716 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |