# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
548854 | rainboy | Printed Circuit Board (CEOI12_circuit) | C11 | 61 ms | 1884 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 <stdio.h>
#define N 200000
long long cross(int x1, int y1, int x2, int y2) {
return (long long) x1 * y2 - (long long) x2 * y1;
}
int xx[N], yy[N], n;
long long cross2(int i, int j) {
i %= n, j %= n;
return cross(xx[i], yy[i], xx[j], yy[j]);
}
long long cross3(int i, int j, int k) {
i %= n, j %= n, k %= n;
return cross(xx[j] - xx[i], yy[j] - yy[i], xx[k] - xx[i], yy[k] - yy[i]);
}
int compare(int i, int j) {
int i0 = i, i1 = i + 1, j0 = j, j1 = j + 1, tmp;
long long c0, c1;
if (cross2(i0, i1) > 0)
tmp = i0, i0 = i1, i1 = tmp;
if (cross2(j0, j1) > 0)
tmp = j0, j0 = j1, j1 = tmp;
c0 = cross3(i0, i1, j0), c1 = cross3(i0, i1, j1);
if (c0 >= 0 && c1 >= 0)
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |