QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#182735 | #5373. 投影对称 | Lynkcat# | 0 | 24ms | 3940kb | C++20 | 2.5kb | 2023-09-18 14:47:50 | 2024-07-04 02:02:09 |
Judging History
answer
#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 998244353
#define sz(x) ((int)((x).size()))
#define int ll
#define N 2005
using namespace std;
class point{
public:
double x;
double y;
point(double x_=0,double y_=0):x(x_),y(y_){}
friend const bool operator<(const point& p1,const point& p2){
return (p1.x==p2.x)?p1.y<p2.y:p1.y<p2.y;
};
friend const point operator+(const point& p1,const point& p2){
return point(p1.x+p2.x,p1.y+p2.y);
};
friend const point operator-(const point& p1,const point& p2){
return point(p1.x-p2.x,p1.y-p2.y);
};
friend const point operator*(const point& p,const double& m){
return point(p.x*m,p.y*m);
};
friend const point operator*(const double& m,const point& p){
return point(p.x*m,p.y*m);
};
friend const point operator/(const point& p,const double& m){
return point(p.x/m,p.y/m);
};
friend ostream& operator <<(ostream& out,point& a){
printf("(%lf,%lf)",a.x,a.y);
return out;
};
};
int n,dfn[N],DFN;
point a[N];
typedef point vect2;
class line{
public:
point start;
point end;
line(point s=point(0,0),point e=point(0,0)):start(s),end(e){}
};
double dot(point x,point y)
{
return x.x*y.x+x.y*y.y;
}
point projection(point p,point a,point b)
{
point v = b - a,u = p - a;
return a + v * (dot(v,u) / dot(v,v)); //dot是两向量的点积
}
void BellaKira()
{
cin>>n;
for (int i=1;i<=n;i++)
cin>>a[i].x>>a[i].y,a[i].x*=2,a[i].y*=2;
if (n<=2)
{
cout<<"-1\n";
return;
}
//check (0,0)
{
map<pa,int>Mp;
bool ans=1;
for (int i=1;i<=n;i++)
{
if (a[i].x==0&&a[i].y==0) continue;
if (Mp.count(mp(-a[i].x,-a[i].y))) Mp.erase(mp(-a[i].x,-a[i].y));
else Mp[mp(a[i].x,a[i].y)]=1;
}
if (Mp.empty())
{
cout<<"-1\n";
return;
}
}
int ans=n;
for (int i=1;i<=n;i++)
{
map<double,int>Mp;
for (int j=1;j<=n;j++)
if (j!=i)
{
point now=a[j]-a[i];
Mp[now.y/now.x]++;
}
ans=min(ans,(int)Mp.size()+1);
}
cout<<ans<<'\n';
}
signed main()
{
IOS;
cin.tie(0);
int T=1;
while (T--)
{
BellaKira();
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 10
Accepted
time: 0ms
memory: 3684kb
input:
3 32650 -45713 899736 648739 381340 196264
output:
3
result:
ok single line: '3'
Test #2:
score: -10
Wrong Answer
time: 0ms
memory: 3940kb
input:
3 1 1 1 4 1 5
output:
2
result:
wrong answer 1st lines differ - expected: '1', found: '2'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Wrong Answer
Test #13:
score: 0
Wrong Answer
time: 24ms
memory: 3896kb
input:
1986 -130037 -139562 -244707 -368070 -124449 -171906 -121655 -188078 27969 61170 148227 257334 -54541 -130426 183181 278074 97877 102650 218135 298814 0 -999131 0 999131 0 -997957 0 997957 0 -997214 0 997214 0 -993580 0 993580 0 -992530 0 992530 0 -989565 0 989565 0 -989244 0 989244 0 -988703 0 9887...
output:
12
result:
wrong answer 1st lines differ - expected: '5', found: '12'
Subtask #4:
score: 0
Skipped
Dependency #1:
0%