Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <vector>
- #include <string>
- #include <cmath>
- #include <iostream>
- #include <unordered_set>
- using namespace std;
- //ax + by + c = 0
- //x = (-by - c)/a
- // y = (-ax - c)/b
- struct Point {
- double x;
- double y;
- unordered_set<int> h;
- int h_sum = 0;
- };
- struct Line {
- double a, b, c;
- };
- double scalar_product(const Point &p1, Point &p2) {
- return p1.x * p2.y - p2.x * p1.y;
- }
- double check_line_point(Line line, Point point) {
- return line.a * point.x + line.b * point.y + line.c;
- }
- int main() {
- int n, m, r;
- cin >> n >> m >> r;
- vector<Point> points(n);
- vector<Line> lines(m);
- for (int i = 0; i < n; ++i){
- double x, y;
- cin >> x >> y;
- points[i] = {x, y};
- }
- for (int i = 0; i < m; ++i){
- double a, b, c;
- cin >> a >> b >> c;
- lines[i] = {a, b, c};
- }
- for (int k = 0; k < n; ++k){
- auto& point = points[k];
- for (int i = 0; i < m; ++i){
- if (check_line_point(lines[i], point) > 0){
- point.h.insert(i);
- point.h_sum += i;
- }
- }
- for (int i = 0; i < k; ++i){
- if (points[i].h.size() == point.h.size() && points[i].h_sum == point.h_sum && points[i].h == point.h){
- cout << "YES";
- return 0;
- }
- }
- }
- cout << "NO";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement