QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#513555#9168. Square Locatorucup-team3474#RE 0ms3576kbC++231.9kb2024-08-10 18:16:592024-08-10 18:16:59

Judging History

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

  • [2024-08-10 18:16:59]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:3576kb
  • [2024-08-10 18:16:59]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const  int N=1919810;
typedef __int128 ll;
typedef pair<ll,ll> PII;

long long oa,ob,oc,od;

typedef struct{
    ll fz,fm;
}Node;

ll Sqrt(ll x){
    ll l=0,r=1e15;
    while(l<r){
        ll mid=l+r+1>>1;
        if(mid*mid<=x) l=mid;
        else r=mid-1;
    }
    assert(l*l==x);
    return l;
}


__int128 read(){
    long long x;
    cin>>x;
    return x;
}


bool check2(ll xb,ll yb,ll xc,ll yc,ll xd,ll yd){
    if(xb*xb+yb*yb!=ob) return false;
    if(xc*xc+yc*yc!=oc) return false;
    if(xd*xd+yd*yd!=od) return false;
    return true;
}


void check(ll xm,ll ym){
    //swap(ym,xm);
    //cout<<xm<<" "<<ym<<endl;
    long long xa=0,ya=Sqrt(oa);
    long long xb,xc,xd,yb,yc,yd;
    xc=2*xm-xa,yc=2*ym-ya;
    long long dx=(xa-xm),dy=(ya-ym);
    long long ddx=-dy,ddy=dx;
    xb=xm+ddx,yb=ym+ddy;
    xd=xm-ddx,yd=ym-ddy;
   // cout<<ya<<" "<<xb<<" "<<yb<<" "<<xc<<" "<<yc<<" "<<xd<<" "<<yd<<endl;

    if(check2(xb,yb,xc,yc,xd,yd)){
        cout<<ya/2<<" "<<xb/2<<" "<<yb/2<<" "<<xc/2<<" "<<yc/2<<" "<<xd/2<<" "<<yd/2<<endl;
        exit(0);
    }
    if(check2(xd,yd,xc,yc,xb,yb)){
        cout<<ya/2<<" "<<xd/2<<" "<<yd/2<<" "<<xc/2<<" "<<yc/2<<" "<<xb/2<<" "<<yb/2<<endl;
        exit(0);
    }
}



int main(){
    oa=read(),ob=read(),oc=read(),od=read();
    oa*=4,ob*=4,oc*=4,od*=4;
    ll val;
    val=(oa+ob+oc+od)/4;
    //cout<<val<<endl;
    //val.fm=4;
    ll S=(od-ob)/4;
    if(S<0) S=-S;
    
    ll ooa=Sqrt(oa);
    ll h=S/ooa;
    //cout<<S<<" "<<ooa<<" "<<h<<endl;
    ll ua=2*ooa;
    ll ub=8*val-4*oa-16*h*h;
    ll xx=Sqrt(ub);
    //cout<<ua<<" "<<ub<<endl;
    //cout<<2*h*h+oa-val<<endl;
    ll a1=(ua+xx)/4,a2=(ua-xx)/4;
    //cout<<a1<<" "<<a2<<endl;
    check(h,ooa-a1);
    check(-h,ooa-a1);
    check(h,ooa-a2);
    check(-h,ooa-a2);

}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3576kb

input:

36 5 10 41

output:

6 -2 1 3 -1 5 4

result:

ok Answer is correct

Test #2:

score: 0
Accepted
time: 0ms
memory: 3508kb

input:

1 1 1 1

output:

1 -1 0 0 -1 1 0

result:

ok Answer is correct

Test #3:

score: -100
Runtime Error

input:

1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000

output:


result: