답안 #963533

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
963533 2024-04-15T09:27:32 Z ttttttttttttth Zvijezda (COCI19_zvijezda) C++17
0 / 110
1000 ms 4840 KB
// 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)
        {
            auto dir = cross(x, y, a[i].fi, a[i].se, a[(i + 1) % n].fi, a[(i + 1) % n].se);
            if (dir < 0) flag++;
            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

zvijezda.cpp: In function 'int main()':
zvijezda.cpp:67:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   67 |         freopen("in", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~
zvijezda.cpp:69:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   69 |         freopen(TASKNAME ".inp", "r", stdin),
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
zvijezda.cpp:70:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   70 |                 freopen(TASKNAME ".out", "w", stdout);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1034 ms 4840 KB Time limit exceeded
2 Halted 0 ms 0 KB -