이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double ld;
const int MAXN = (int)1e5 + 7;
const int infint = (int)1e9;
const int MOD = (int)1e9 + 9;
const ll inf = (ll)2e18 + 2;
struct point{
ll x, y;
point operator - (const point &other) const
{
return {x - other.x, y - other.y};
}
};
vector<point> terminal;
bool cross(point a, point b)
{
return 1LL * a.x * b.y > 1LL * a.y * b.x;
}
bool check(point a)
{
return a.x > 0 || (a.x == 0 && a.y > 0);
}
bool cmp(point a, point b)
{
//clockwise correct.
if(check(a) != check(b))
return check(a);
return cross(a, b);
}
int get_first(point P)
{
int L = 0, R = terminal.size() - 1;
while(L <= R)
{
int mid = (L + R) >> 1;
if(cmp(P, terminal[mid]))
R = mid - 1;
else
L = mid + 1;
}
return L % terminal.size();
}
ll w, h, m, n, can[MAXN];
point S, T[MAXN], C[MAXN];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin >> w >> h >> S.x >> S.y;
cin >> m;
for (int i = 0; i < m; i++)
{
cin >> C[i].x >> C[i].y;
can[i] = 1;
}
cin >> n;
for (int i = 0; i < n; i++)
cin >> T[i].x >> T[i].y;
for (int i = 0; i < n; i++)
{
terminal.clear();
for (int j = 0; j < n; j++)
if(j != i)
terminal.push_back(T[i] - T[j]);
sort(terminal.begin(), terminal.end(), cmp);
int saboon = get_first(S - T[i]);
for (int j = 0; j < m; j++)
if(get_first(C[j] - T[i]) != saboon)
can[j] = 0;
}
vector<int> ans;
for (int i = 0; i < m; i++)
if(can[i])
ans.push_back(i);
cout << ans.size() << "\n";
for (auto u : ans)
cout << u + 1 << " ";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |