# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
838204 | 2023-08-26T10:30:45 Z | EntityPlantt | Planine (COCI21_planine) | C++17 | 205 ms | 15916 KB |
#include <cstdio> #include <algorithm> using namespace std; typedef long long ll; struct frac { ll x, y; void upd() { if (y < 0LL) { x *= -1LL; y *= -1LL; } } bool operator<(const frac &f) const { return x * f.y < y * f.x; } } l; ll n, h, i, c = 1, x1, y1, x2, y2, x3, y3; pair <frac, frac> inte[500005]; int main() { scanf("%lld%lld%lld%lld%lld%lld", &n, &h, &x3, &y3, &x3, &y3); if (n == 3) { printf("0"); return 0; } n = n / 2 - 1; for (i = 0; i < n; i++) { x1 = x3; y1 = y3; scanf("%lld%lld%lld%lld", &x2, &y2, &x3, &y3); /*inte[i].first = {x1 * (y1 - y2) + (h - y1) * (x1 - x2), y1 - y2}; inte[i].second = {x2 * (y2 - y3) + (h - y2) * (x2 - x3), y2 - y3};*/ inte[i].first = {x2 * (y1 - y2) + (h - y2) * (x1 - x2), y1 - y2}; inte[i].second = {x2 * (y3 - y2) + (h - y2) * (x3 - x2), y3 - y2}; inte[i].first.upd(); inte[i].second.upd(); } sort(inte, inte + n, [](auto &a, auto &b) { return a.second < b.second; }); l = inte[0].second; for (i = 1; i < n; i++) { if (l < inte[i].first) { l = inte[i].second; c++; } } printf("%lld", c); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 340 KB | Output is correct |
2 | Correct | 2 ms | 340 KB | Output is correct |
3 | Correct | 2 ms | 340 KB | Output is correct |
4 | Correct | 13 ms | 1748 KB | Output is correct |
5 | Correct | 22 ms | 1748 KB | Output is correct |
6 | Correct | 17 ms | 1748 KB | Output is correct |
7 | Correct | 143 ms | 15808 KB | Output is correct |
8 | Correct | 205 ms | 15904 KB | Output is correct |
9 | Correct | 155 ms | 15916 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 340 KB | Output is correct |
2 | Correct | 2 ms | 340 KB | Output is correct |
3 | Correct | 2 ms | 340 KB | Output is correct |
4 | Correct | 13 ms | 1748 KB | Output is correct |
5 | Correct | 22 ms | 1748 KB | Output is correct |
6 | Correct | 17 ms | 1748 KB | Output is correct |
7 | Correct | 143 ms | 15808 KB | Output is correct |
8 | Correct | 205 ms | 15904 KB | Output is correct |
9 | Correct | 155 ms | 15916 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Incorrect | 1 ms | 212 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |