#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 cmp(point a, point b)
{
//clockwise correct.
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 |
1 |
Incorrect |
2 ms |
380 KB |
Output isn't correct |
2 |
Correct |
2 ms |
456 KB |
Output is correct |
3 |
Correct |
2 ms |
456 KB |
Output is correct |
4 |
Correct |
2 ms |
476 KB |
Output is correct |
5 |
Incorrect |
2 ms |
480 KB |
Output isn't correct |
6 |
Correct |
2 ms |
480 KB |
Output is correct |
7 |
Correct |
2 ms |
488 KB |
Output is correct |
8 |
Correct |
2 ms |
504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
528 KB |
Output is correct |
2 |
Correct |
2 ms |
712 KB |
Output is correct |
3 |
Correct |
3 ms |
736 KB |
Output is correct |
4 |
Correct |
2 ms |
736 KB |
Output is correct |
5 |
Correct |
3 ms |
736 KB |
Output is correct |
6 |
Correct |
3 ms |
736 KB |
Output is correct |
7 |
Correct |
2 ms |
736 KB |
Output is correct |
8 |
Correct |
2 ms |
736 KB |
Output is correct |
9 |
Correct |
2 ms |
736 KB |
Output is correct |
10 |
Correct |
5 ms |
736 KB |
Output is correct |
11 |
Correct |
5 ms |
736 KB |
Output is correct |
12 |
Correct |
5 ms |
736 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
736 KB |
Output is correct |
2 |
Correct |
2 ms |
736 KB |
Output is correct |
3 |
Correct |
2 ms |
736 KB |
Output is correct |
4 |
Correct |
90 ms |
812 KB |
Output is correct |
5 |
Correct |
20 ms |
812 KB |
Output is correct |
6 |
Correct |
379 ms |
1000 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
478 ms |
1000 KB |
Output is correct |
2 |
Correct |
1173 ms |
1312 KB |
Output is correct |
3 |
Correct |
1274 ms |
1528 KB |
Output is correct |
4 |
Correct |
1010 ms |
1684 KB |
Output is correct |