| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 226265 | dolphingarlic | Dragon 2 (JOI17_dragon2) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
struct Point { ll x, y; } A, B;
bool ccw(Point X, Point Y, Point Z) { return (X.x - Y.x) * (Z.y - Y.y) <= (X.y - Y.y) * (Z.x - Y.x); }
vector<Point> by_t[30001];
int main() {
int n, m, q, x, y;
scanf("%d %d", &n, &m);
while (n--) {
scanf("%d %d %d", &A.x, &A.y, &A.q);
by_t[q].push_back(A);
}
scanf("%d %d %d %d %d", &A.x, &A.y, &B.x, &B.y, &q);
while (q--) {
scanf("%d %d", &x, &y);
m = 0;
for (Point i : by_t[x]) for (Point j : by_t[y]) {
if (ccw(i, A, B)) m += (ccw(i, A, j) && ccw(j, B, i));
else m += (ccw(j, A, i) && ccw(i, B, j));
}
printf("%d\n", m);
}
return 0;
}
