Last active
December 22, 2025 06:51
-
-
Save Mjkim-Programming/53e06d4cce2ee0b78c9bebcab21b8f11 to your computer and use it in GitHub Desktop.
Basic code for BOJ 34702
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| #define ll long long | |
| #define FASTIO \ | |
| cin.tie(NULL); \ | |
| ios::sync_with_stdio(false); | |
| #define END return 0; | |
| #define out cout << | |
| #define in cin >> | |
| using namespace std; | |
| struct Point { | |
| ll x, y; | |
| Point() {} | |
| Point(ll _x, ll _y) : x(_x), y(_y) {} | |
| }; | |
| Point operator+(const Point& a, const Point& b) { | |
| return Point(a.x+b.x, a.y+b.y); | |
| } | |
| Point operator-(const Point& a, const Point& b) { | |
| return Point(a.x-b.x, a.y-b.y); | |
| } | |
| Point operator*(const Point& a, ll k) { | |
| return Point(a.x*k, a.y*k); | |
| } | |
| ll dot(const Point& a, const Point& b) { | |
| return a.x*b.x + a.y*b.y; | |
| } | |
| ll cross(const Point& a, const Point& b) { | |
| return a.x*b.y - a.y*b.x; | |
| } | |
| ll orient(const Point& a, const Point& b, const Point& c) { | |
| return cross(b-a, c-a); | |
| } | |
| int ccw(const Point& a, const Point& b, const Point& c) { | |
| ll v = orient(a, b, c); | |
| if (v>0) return 1; | |
| if (v<0) return -1; | |
| return 0; | |
| } | |
| bool is_left_turn(const Point& a, const Point& b, const Point& c) { | |
| return orient(a, b, c) > 0; | |
| } | |
| bool is_right_turn(const Point& a, const Point& b, const Point& c) { | |
| return orient(a, b, c) < 0; | |
| } | |
| ll dist2(const Point& a, const Point& b) { | |
| ll dx = a.x - b.x; | |
| ll dy = a.y - b.y; | |
| return dx*dx + dy*dy; | |
| } | |
| //Circular Index Helper | |
| int nxt(int i, int n) { | |
| return (i+1 == n ? 0 : i+1); | |
| } | |
| int prv(int i, int n) { | |
| return (i == 0 ? n-1 : i-1); | |
| } | |
| int main() { | |
| FASTIO | |
| ll N, M, K; in N>>M>>K; | |
| // Build Point Set P | |
| vector<Point> p(N); | |
| vector<Point> q(M); | |
| for(ll i = 0; i < N; i++) { | |
| Point temp; | |
| in temp.x>>temp.y; | |
| p[i] = temp; | |
| } | |
| // Build Point Set Q | |
| for(ll i = 0; i < M; i++) { | |
| Point temp; | |
| in temp.x>>temp.y; | |
| q[i] = temp; | |
| } | |
| // Calculate Query | |
| while(K--) { | |
| // Get Query | |
| ll i, j; | |
| in i>>j; | |
| //TODO implement query calculation | |
| } | |
| END | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment