제출 #456192

#제출 시각아이디문제언어결과실행 시간메모리
456192grtZvijezda (COCI19_zvijezda)C++17
0 / 110
81 ms7760 KiB
#include <bits/stdc++.h> #define ST first #define ND second #define PB push_back using namespace std; using ll = long long; using pi = pair<int,int>; using vi = vector<int>; struct Point { ll x, y; }; const int nax = 1e5 + 10; int t, n, q; Point p[nax]; ll det(Point a, Point b, Point c) { return (b.x - a.x) * (c.y - a.y) - (c.x - a.x) * (b.y - a.y); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> t >> n; for(int i = 0; i < n; ++i) { cin >> p[i].x >> p[i].y; } int cnt = 0; cin >> q; while(q--) { ll a, b; cin >> a >> b; a ^= (ll)cnt * cnt * cnt * t; b ^= (ll)cnt * cnt * cnt * t; bool sign = det(p[0], p[1], {a, b}) >= 0; int r = 0; for(int i = 1; i < n; ++i) { if((det(p[i], p[(i + 1) % n], {a, b}) >= 0) == sign) { r = i; } else { break; } } int l = 0; for(int i = n - 1; i >= 1; --i) { if((det(p[i], p[(i + 1) % n], {a, b}) >= 0) == sign) { l = i; } else { break; } } //cout << sign << " " << l << " " << r << "\n"; bool w = false; if(r == n - 1) { if(sign) w = true; } else { if(sign) { if(((n - l) % n) + r + 1 > n / 2) w = true; } else { if(((n - l) % n) + r + 1 < n / 2) w = true; } } cnt += w; if(w) cout << "DA\n"; else cout << "NE\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...