답안 #711741

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
711741 2023-03-17T11:54:40 Z becaido Zvijezda (COCI19_zvijezda) C++17
0 / 110
29 ms 3516 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,popcnt,sse4,abm")
#include <bits/stdc++.h>
using namespace std;

#ifdef WAIMAI
#define debug(HEHE...) cout << "[" << #HEHE << "] : ", dout(HEHE)
void dout() {cout << '\n';}
template<typename T, typename...U>
void dout(T t, U...u) {cout << t << (sizeof... (u) ? ", " : ""), dout (u...);}
#else
#define debug(...) 7122
#endif

#define ll long long
#define Waimai ios::sync_with_stdio(false), cin.tie(0)
#define FOR(x,a,b) for (int x = a, I = b; x <= I; x++)
#define pb emplace_back
#define F first
#define S second

using point = pair<int, int>;

const int SIZE = 1e5 + 5;

int subtask, n, q;
point p[SIZE];

ll cross(point a, point b) {
    return 1ll * a.F * b.S - 1ll * a.S * b.F;
}

point operator - (point a, point b) {
    return point(a.F - b.F, a.S - b.S);
}

void solve() {
    cin >> subtask >> n;
    FOR (i, 1, n) cin >> p[i].F >> p[i].S;
    cin >> q;
    while (q--) {
        point P;
        cin >> P.F >> P.S;
        bool f = 0;
        FOR (i, 1, n / 2) {
            auto p1 = p[i], p2 = p[i + 1];
            auto p3 = p[i + n / 2], p4 = p[i + n / 2 + 1 > n ? 1 : i + n / 2 + 1];
            if (cross(p1 - P, p2 - P) >= 0 && cross(p3 - P, p4 - P) >= 0) {
                f = 1;
                break;
            }
        }
        cout << (f ? "DA" : "NE") << '\n';
    }
}

int main() {
    Waimai;
    solve();
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 29 ms 3516 KB Output isn't correct
2 Halted 0 ms 0 KB -