Mógłby ktoś podać test dla którego mam WA?
[bbone=cpp,745]
//Jakub Stanecki XVI LO im. Stanisława Staszica w Warszawie
include
include
include
include
include
include
include
using namespace std;
define FOR(x, b, e) for(int x = b; x <= (e); ++x)
define FORD(x, b, e) for(int x = b; x >= (e); --x)
define REP(x, n) for(int x = 0; x < (n); ++x)
define VAR(v, n) __typeof(n) v = (n)
define ALL(c) (c).begin(), (c).end()
define SIZE(x) ((int)(x).size())
define FOREACH(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
define PB push_back
define ST first
define ND second
define PF push_front
define MP make_pair
define KW(a) ((a)*(a))
const int INF = 1000000001;
const double EPS=10e-8;
bool isZero(long double a)
{
return abs(a)<=EPS;
}
typedef long double ptype;
typedef pair PPP;
typedef vector VPPP;
bool sym(long double kat, VPPP punkty)
{
REP(x,SIZE(punkty))
{
ptype xx=punkty[x].ST*cos(kat*M_PIl/180)-punkty[x].ND*sin(kat*M_PIl/180);
ptype yy=punkty[x].ST*sin(kat*M_PIl/180)+punkty[x].ND*cos(kat*M_PIl/180);
punkty[x]=MP(xx,yy);
}
VPPP punkty1;
VPPP punkty2;
REP(x,SIZE(punkty))
{
if (!isZero(punkty[x].ND))
{
if (punkty[x].ND>0)
{
punkty1.PB(punkty[x]);
}
else
{
punkty[x].ND*=-1;
punkty2.PB(punkty[x]);
}
}
}
if (SIZE(punkty1)!=SIZE(punkty2))
{
return false;
}
else
{
sort(ALL(punkty1));
sort(ALL(punkty2));
REP(x,SIZE(punkty1))
{
if (!isZero(punkty1[x].ST-punkty2[x].ST) || !isZero(punkty1[x].ND-punkty2[x].ND))
{
return false;
}
}
}
return true;
}
long double mo(long double a)
{
while(a<0) a+=360;
while(a>=360) a-=360;
return a;
}
int main()
{
int n;
scanf("%d",&n);
VPPP points;
PPP co;
ptype xx=0;
ptype yy=0;
REP(x,n)
{
scanf("%Lf %Lf",&co.ST,&co.ND);
points.PB(co);
xx+=co.ST;
yy+=co.ND;
}
xx/=n;
yy/=n;
VPPP punkty;
REP(x,SIZE(points))
{
ptype aa=points[x].ST-xx;
ptype bb=points[x].ND-yy;
if (!isZero(aa) || !isZero(bb))
{
punkty.PB(MP(aa,bb));
}
}
vector<ptype> wyn;
REP(y,SIZE(punkty))
{
ptype ff=punkty[0].ST+punkty[y].ST;
ptype tt=punkty[0].ND+punkty[y].ND;
ff/=2;
tt/=2;
ptype sina=tt/sqrtl((KW(ff)+KW(tt)));
ptype kat=mo((asin(sina)*(180/M_PIl)));
if (sym(kat,punkty))
{
wyn.PB(kat);
}
if (sym(mo(180-kat),punkty))
{
wyn.PB(mo(180-kat));
}
}
sort(ALL(wyn));
printf("%.10Lf %.10Lf\n",fabs(xx),fabs(yy));
map<ptype,bool> bylo;
REP(x,SIZE(wyn))
{
ptype cso=wyn[x]*(M_PIl/180);
if (!bylo[cso])
{
printf("%.10Lf\n",cso);
bylo[cso]=1;
}
}
return 0;
}
[/bbone]