#include #include #include #include #define MAX_B 10000 #define DIST2(a,b) (((a).x-(b).x)*((a).x-(b).x)+((a).y-(b).y)*((a).y-(b).y)) #define EPS 1e-10 double N; struct bod { double x; double y; } body[MAX_B]; int B; struct udalost { double uhel; int bod; } u[ 2*MAX_B]; int U; int udalost_cmp_uhel(const void* a, const void* b) { if (((struct udalost*)a)->uhel == ((struct udalost*)b)->uhel) return 0; return ((struct udalost*)a)->uhel < ((struct udalost*)b)->uhel ? -1 : 1; } int main(void) { scanf("%d%lf", &B, &N); assert(B>=1); for (int i=0;i4*N*N) continue; double uhel_zaklad=atan2(body[j].y-body[i].y,body[j].x-body[i].x); if (uhel_zaklad<0) uhel_zaklad+=2*M_PI; double uhel_zmena=acos(sqrt(d)/(2.0*N)); u[U].bod=j; u[U++].uhel=uhel_zaklad-uhel_zmena-EPS; // dvě události, první vstup u[U].bod=j; u[U++].uhel=uhel_zaklad+uhel_zmena+EPS; // a druhá výstup z kružnice if (u[U-2].uhel< 0 ) u[U-2].uhel+=2*M_PI; // normalizace if (u[U-1].uhel>=2*M_PI) u[U-1].uhel-=2*M_PI; act+=body_uvnitr[j]=u[U-1].uhelbest) best=act, best_pos=body[i], best_uhel=u[j].uhel; //aktualizuj maximum } } printf("Temný mák získá %d temných kamenů, pokud zakouzlí v (%g,%g)\n", best, best_pos.x+cos(best_uhel)*N, best_pos.y+sin(best_uhel)*N); return 0; }