# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
837519 | EntityPlantt | Planine (COCI21_planine) | C++14 | 2 ms | 340 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <algorithm>
using namespace std;
int n, h, i, c = 0;
#define st first
#define en second
pair <double, double> inte[500005];
double x1, y1, x2, y2, x3, y3, l = -1e9;
int main() {
scanf("%d%d%lf%lf%lf%lf", &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("%lf%lf%lf%lf", &x2, &y2, &x3, &y3);
inte[i].st = x1 + (h - y1) * (x1 - x2) / (y1 - y2);
inte[i].en = x2 + (h - y2) * (x2 - x3) / (y2 - y3);
}
sort(inte, inte + n);
for (i = 0; i < n; i++) {
if (l + 1e-10 < inte[i].st) {
l = inte[i].en;
c++;
}
}
printf("%d", c);
return 0;
}
컴파일 시 표준 에러 (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... |