# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
963535 | ttttttttttttth | Zvijezda (COCI19_zvijezda) | C++17 | 1046 ms | 2648 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Author: Ivan Teo
// Created: Mon Apr 15 14:41:22 2024
#define TASKNAME "tomau"
#include <bits/stdc++.h>
using namespace std;
#define fore(i, a, b) for (int i = (a); i <= (b); i++)
#define int long long
using vi = vector<int>;
using ii = pair<int, int>;
#define pb emplace_back
#define fi first
#define se second
#define sz(v) ((int)v.size())
#define all(v) v.begin() + 1, v.end()
#define alll(v) v.begin(), v.end()
#define db(x) cerr << "[" << #x << " = " << x << "]"
#define el cerr << "\n=============================\n"
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int Rand(int l, int r)
{
assert(l <= r);
return uniform_int_distribution<int> (l, r)(rng);
}
__int128 cross(int x0, int y0, int x1, int y1, int x2, int y2)
{
return (__int128) (x1 - x0) * (y2 - y0) - (__int128) (x2 - x0) * (y1 - y0);
}
const int maxn = 2e5 + 5;
ii a[maxn];
int n, q, t;
void solve()
{
cin >> t >> n;
fore(i, 0, n - 1) cin >> a[i].fi >> a[i].se;
cin >> q;
int p = 0;
while (q--)
{
int x, y;
cin >> x >> y;
if (t) x ^= p * p * p, y ^= p * p * p;
int flag = 0;
fore(i, 0, n - 1)
{
__int128 dir = cross(x, y, a[i].fi, a[i].se, a[(i + 1) % n].fi, a[(i + 1) % n].se);
if (dir < 0) flag++;
else if (dir == 0)
{
flag = 0;
break;
}
}
if (flag < n / 2) cout << "YES";
else cout << "NO";
cout << '\n';
}
}
signed main()
{
cin.tie(0)->sync_with_stdio(0);
if (fopen("in", "r"))
freopen("in", "r", stdin);
if (fopen(TASKNAME ".inp", "r"))
freopen(TASKNAME ".inp", "r", stdin),
freopen(TASKNAME ".out", "w", stdout);
int tc = 1;
// cin >> tc;
while (tc--)
solve();
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |