QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#182789#5373. 投影对称Lynkcat#0 10ms5816kbC++202.7kb2023-09-18 15:45:102024-07-04 02:02:13

Judging History

你现在查看的是最新测评结果

  • [2024-07-04 02:02:13]
  • 评测
  • 测评结果:0
  • 用时:10ms
  • 内存:5816kb
  • [2023-09-18 15:45:10]
  • 提交

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:
	int x;
	int y;
	point(int x_=0,int 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.x<p2.x;
	};
	friend const bool operator==(const point& p1,const point& p2){
		return (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& p1,const point& p2){
		return point(p1.x-p2.x,p1.y-p2.y);
	};
};
int n,dfn[N],DFN;
point a[N];
int vis[N];
point cz(point x)
{
    if (x.x==0) return point(1,0);
    if (x.y==0) return point(0,1);
    
    return point(x.y,-x.x);
}
point hj(point nw)
{
    if (nw.x<0) nw.y*=-1,nw.x*=-1;
    int g=__gcd(abs(nw.x),abs(nw.y));
    nw.x/=g,nw.y/=g;
    return nw;
}
void BellaKira()
{
    cin>>n;
    int sx=0,sy=0;
    for (int i=1;i<=n;i++)
        cin>>a[i].x>>a[i].y,a[i].x*=n,a[i].y*=n,sx+=a[i].x,sy+=a[i].y;
    sx/=n,sy/=n;
    if (n<=2)
    {
        cout<<"-1\n";
        return;
    }
    map<point,poly>all;
    point mid=point(sx,sy);
    cout<<sx<<" "<<sy<<endl;
    for (int i=1;i<=n;i++) vis[i]|=(a[i]==mid);
    for (int i=1;i<=n;i++)
        if (!vis[i])
        {
            point x=a[i]-mid;
            x=cz(x),x=hj(x);
            all[x].push_back(i);
        }
    for (int i=1;i<=n;i++)
        for (int j=i+1;j<=n;j++)
        {
            if (vis[i]||vis[j]) continue;
            point x=a[i]-mid,y=a[j]-mid;
            if ((x+y)==point(0,0))
            {
                vis[i]=1;vis[j]=1;
                continue;
            }
            point nw=cz(x+y);
            if (nw.x<0) nw.y*=-1,nw.x*=-1;
            int g=__gcd(abs(nw.x),abs(nw.y));
            nw.x/=g,nw.y/=g;
            all[nw].push_back(i);
            all[nw].push_back(j);
            // cout<<i<<" "<<j<<" "<<nw.x<<" "<<nw.y<<endl;
        }
    int nn=0;
    for (int i=1;i<=n;i++) if (!vis[i]) nn++;
    if (nn==0)
    {
        cout<<"-1\n";
        return;
    }
    int ans=0;
    for (auto [u,g]:all)
    {
        DFN++;
        int t=0;
        for (auto v:g)
        {
            if (dfn[v]!=DFN&&!vis[v]) t++,dfn[v]=DFN;
        }
        if (t==nn) ans++;
    }
    cout<<ans<<'\n';
}
signed main()
{
    IOS;
    cin.tie(0);
    int T=1;
    while (T--)
    {
        BellaKira();
    }
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3692kb

input:

3
32650 -45713
899736 648739
381340 196264

output:

1313726 799290
3

result:

wrong answer 1st lines differ - expected: '3', found: '1313726 799290'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Wrong Answer

Test #13:

score: 0
Wrong Answer
time: 10ms
memory: 5816kb

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:

0 0
5

result:

wrong answer 1st lines differ - expected: '5', found: '0 0'

Subtask #4:

score: 0
Skipped

Dependency #1:

0%