Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define int long long
- struct point {
- int x, y;
- void read() {
- cin >> x >> y;
- }
- void write() {
- cout << x << ' ' << y << '\n';
- }
- point operator - (const point &B) const {
- return point{x - B.x, y - B.y};
- }
- void operator -= (const point &B) {
- x -= B.x;
- y -= B.y;
- }
- int operator * (const point &B) const {
- return x * B.y - y * B.x;
- }
- int orientation(const point &A, const point &B) const {
- return (A - *this) * (B - *this);
- }
- int dist(point A) {
- A -= *this;
- return A.x * A.x + A.y * A.y;
- }
- bool operator <(const point &A) {
- if(x == A.x) {
- return y < A.y;
- }
- return x < A.x;
- }
- };
- int32_t main() {
- int T;
- cin >> T;
- while(T--) {
- point P1, P2, P3;
- P1.read();
- P2.read();
- P3.read();
- P2 -= P1;
- P3 -= P1;
- int orientation = P3 * P2;
- if(orientation == 0) cout << "TOUCH\n";
- else if(orientation < 0) cout << "LEFT\n";
- else cout << "RIGHT\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment