Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #define pb emplace_back
- #define AI(i) begin(i), end(i)
- using namespace std;
- using ll = long long;
- template<class T> bool chmin(T &a, T b) { return b < a && (a = b, true); }
- template<class T> bool chmax(T &a, T b) { return a < b && (a = b, true); }
- #ifdef KEV
- #define DE(args...) kout("[ " + string(#args) + " ] = ", args)
- void kout() {cerr << endl;}
- template<class T, class ...U> void kout (T v, U ...e) { cerr << v << ' ', kout(e...); }
- template<class T> void debug(T L, T R) { while (L != R) cerr << *L << " \n"[next(L)==R], ++L; }
- #else
- #define DE(...) 0
- #define debug(...) 0
- #endif
- // What I should check
- // 1. overflow
- // 2. corner cases
- // Enjoy the problem instead of hurrying to AC
- // Good luck !
- const int MAX_N = 300010;
- const double eps = 1e-5;
- bool solve() {
- const int N = 20;
- vector<pair<double,double>> dot(N);
- for (auto &[x, y] : dot)
- cin >> x >> y;
- double area = 0;
- dot.pb(dot[0]);
- for (int i = 0;i < N;++i) {
- area += dot[i].first * dot[i+1].second - dot[i].second * dot[i+1].first;
- }
- dot.pop_back();
- if (area > 0) {
- reverse(AI(dot));
- }
- for (int i = 0;i < N;++i)
- dot.pb(dot[i]);
- auto dis = [&](int a, int b) {
- auto [x1, y1] = dot[a];
- auto [x2, y2] = dot[b];
- return hypot(x1-x2, y1-y2);
- };
- auto close = [&](double v, double u) {
- return abs(u - v) < eps;
- };
- for (int i = 0;i < N;++i) {
- if (close(dis(i, i+1), 6) && close(dis(i+1, i+2), 1))
- return true;
- }
- return false;
- }
- int32_t main() {
- ios_base::sync_with_stdio(0), cin.tie(0);
- int T;
- cin >> T;
- while (T--)
- puts(solve() ? "right" : "left");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement