#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <ll, ll> pll;
pll P[2020], C[10101];
ll D[2020];
ll w, h, n, m, ans;
pll g;
ll ccw(pll pa, pll pb, pll pc)
{
return (pa.first * pb.second + pb.first * pc.second + pc.first * pa.second) -
(pb.first * pa.second + pc.first * pb.second + pa.first * pc.second);
}
bool inside(pll pa, pll pb, pll pc, pll pd)
{
if(ccw(pa, pb, pc) > 0){
if(ccw(pa, pb, pd) > 0 && ccw(pa, pd, pc) > 0) return 1;
else return 0;
}
else{
if(ccw(pa, pb, pd) > 0 || ccw(pa, pd, pc) > 0) return 1;
else return 0;
}
}
int main()
{
ll i, j, l, r;
scanf("%lld%lld%lld%lld", &w, &h, &g.first, &g.second);
scanf("%lld", &m);
for(i=1; i<=m; i++){
scanf("%lld%lld", &C[i].first, &C[i].second);
}
scanf("%lld", &n);
for(i=1; i<=n; i++){
scanf("%lld%lld", &P[i].first, &P[i].second);
}
for(i=1; i<=n; i++){
l = r = -1;
for(j=1; j<=n; j++) if(i != j){
P[j] = pll(2 * P[i].first - P[j].first, 2 * P[i].second - P[j].second);
if(l == -1) l = j;
else if(inside(P[i], P[l], g, P[j])) l = j;
if(r == -1) r = j;
else if(inside(P[i], g, P[r], P[j])) r = j;
}
for(j=1; j<=m; j++){
if(!inside(P[i], P[l], P[r], C[j])){
D[j] = 1;
}
}
for(j=1; j<=n; j++){
P[j] = pll(2 * P[i].first - P[j].first, 2 * P[i].second - P[j].second);
}
}
for(i=1; i<=m; i++){
ans += 1 - D[i];
}
printf("%lld\n", ans);
for(i=1; i<=m; i++){
if(!D[i]) printf("%lld ", i);
}
printf("\n");
return 0;
}
Compilation message
fangorn.cpp: In function 'int main()':
fangorn.cpp:35:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld%lld%lld%lld", &w, &h, &g.first, &g.second);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fangorn.cpp:37:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld", &m);
~~~~~^~~~~~~~~~~~
fangorn.cpp:40:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld%lld", &C[i].first, &C[i].second);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fangorn.cpp:43:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld", &n);
~~~~~^~~~~~~~~~~~
fangorn.cpp:46:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld%lld", &P[i].first, &P[i].second);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
256 KB |
Output is correct |
8 |
Correct |
2 ms |
460 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
256 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
2 ms |
256 KB |
Output is correct |
10 |
Correct |
2 ms |
256 KB |
Output is correct |
11 |
Correct |
2 ms |
256 KB |
Output is correct |
12 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
22 ms |
376 KB |
Output is correct |
5 |
Correct |
6 ms |
384 KB |
Output is correct |
6 |
Correct |
76 ms |
432 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
97 ms |
424 KB |
Output is correct |
2 |
Incorrect |
184 ms |
536 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |