QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#537715 | #9227. Henry the Plumber | wyxqwq | WA | 0ms | 3884kb | C++14 | 2.8kb | 2024-08-30 17:42:55 | 2024-08-30 17:42:57 |
Judging History
answer
#include<bits/stdc++.h>
#define vectorwyx maze
namespace vectorwyx{
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define sml(x,y) (x=min(x,y))
#define big(x,y) (x=max(x,y))
#define ll long long
#define uint unsigned
#define ull unsigned long long
#define umap unordered_map
#define db long double
#define fo(i,x,y) for(int i=(x);i<=(y);++i)
#define go(i,x,y) for(int i=(x);i>=(y);--i)
#define ptc putchar
#define gtc getchar
#define emp emplace
#define re return
#define co continue
#define brk break
#define HH (ptc('\n'))
#define bctz __builtin_ctz
#define bclz __builtin_clz
#define bppc __builtin_popcount
using namespace std;
ll seed=chrono::system_clock::now().time_since_epoch().count();
mt19937 rnd(seed);
inline int rm(int x,int y){return (int)(rnd()%(y-x+1ll)+x);}
inline int read(){signed ch=getchar();int x=0,f=1;while(!isdigit(ch)){if(ch==(int)('-'))f=-1;ch=getchar();}while(isdigit(ch)){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}return x*f;}
template<typename T> void out(T *a,int l,int r){fo(i,l,r) cout<<*(a+i)<<' ';puts("");}
const db eps=1e-30;
struct Frac{
ll fz,fm;
Frac(){fz=0,fm=1;}
Frac(ll x,ll y=1){ll g=__gcd(x,y);fz=x/g,fm=y/g;}
};
Frac operator*(Frac x,Frac y){re Frac(x.fz*y.fz,x.fm*y.fm);}
Frac operator+(Frac x,Frac y){re Frac(x.fz*y.fm+x.fm*y.fz,x.fm*y.fm);}
Frac operator+(Frac x,int y){re Frac(x.fz+x.fm*y,x.fm);}
Frac operator+(int x,Frac y){re Frac(x*y.fm+y.fz,y.fm);}
Frac operator-(Frac x,Frac y){re Frac(x.fz*y.fm-x.fm*y.fz,x.fm*y.fm);}
Frac operator-(Frac x,int y){re Frac(x.fz-x.fm*y,x.fm);}
Frac operator-(int x,Frac y){re Frac(x*y.fm-y.fz,y.fm);}
bool cmp(db x,db y){
if(fabs(x-y)<eps) re 1;
re x>y;
}
void solve(){
int x1,y1,z1,p1,q1,x2,y2,z2,p2,q2;
cin>>x1>>y1>>z1>>p1>>q1>>x2>>y2>>z2>>p2>>q2;
if((x2-x1)*p1+(y2-y1)*q1==0&&(x2-x1)*p2+(y2-y1)*q2==0){puts("2");re;}
if(p1*q2!=q1*p2){
Frac y=Frac(p1*p2*(x2-x1)+p1*q2*y2-p2*q1*y1,p1*q2-q1*p2),x;
if(p1) x=x1-Frac(q1,p1)*(y-y1);
else x=x2-Frac(q2,p2)*(y-y2);
printf("%lld/%lld %lld/%lld\n",x.fz,x.fm,y.fz,y.fm);
Frac qwq=z1*z2+(x-x1)*(x-x2)+(y-y1)*(y-y2);
Frac delta=(z1+z2)*(z1+z2)-Frac(4)* qwq;
if((delta.fz>0&&delta.fm>0)||(delta.fz<0&&delta.fm<0)){puts("3");re;}
if(delta.fz==0){
if((x-x1).fz==0&&(y-y1).fz==0&&(x1-x2)*p2+(y1-y2)*q2==0){puts("4");re;}
if((x-x2).fz==0&&(y-y2).fz==0&&(x1-x2)*p1+(y1-y2)*q1==0){puts("4");re;}
puts("3");re;
}
}
puts("4");
}
signed main(){
int T=read();
while(T--) solve();
return 0;
}
}
/*
2
-1 -1 3
1 1
2 2 3
2 2
5 5 1
3 0
7 6 -2
1 -2
-------------------------------------------------
*/
signed main(){re vectorwyx::main();}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3884kb
input:
2 -1 -1 3 1 1 2 2 3 2 2 5 5 1 3 0 7 6 -2 1 -2
output:
4 5/1 5/1 3
result:
wrong output format Expected integer, but "5/1" found