QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#690493#9227. Henry the PlumberStargazerWA 1ms3556kbC++172.2kb2024-10-30 22:32:052024-10-30 22:32:06

Judging History

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

  • [2024-10-30 22:32:06]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3556kb
  • [2024-10-30 22:32:05]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define cs const
#define re register
#define pb push_back
#define y1 xxxxx
#define pii pair<int,int>
#define ll long long
#define fi first
#define se second
#define bg begin
cs int RLEN=1<<22|1;
char ibuf[RLEN],*ib,*ob;
inline char gc(){
    (ib==ob)&&(ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
    return (ib==ob)?EOF:*ib++;
}
inline int read(){
	char ch=gc();
	int res=0;bool f=1;
	while(!isdigit(ch))f^=ch=='-',ch=gc();
	while(isdigit(ch))res=(res+(res<<2)<<1)+(ch^48),ch=gc();
	return f?res:-res;
}
template<typename tp>inline void chemx(tp &a,tp b){(a<b)?(a=b):0;}
template<typename tp>inline void chemn(tp &a,tp b){(a>b)?(a=b):0;}
#define int long long

int x1,y1,z1,p1,q1;
int x2,y2,z2,p2,q2;

struct pt{
    int x,y;
    pt(int _x=0,int _y=0):x(_x),y(_y){}
    friend inline pt operator +(cs pt &a,cs pt &b){
        return pt(a.x+b.x,a.y+b.y);
    }
    friend inline pt operator -(const pt &a,const pt &b){
        return pt(a.x-b.x,a.y-b.y);
    }
    friend inline ll operator *(const pt &a,const pt &b){
        return 1ll*a.x*b.y-1ll*a.y*b.x;
    }
	friend inline ll operator ^(const pt &a,const pt &b){
		return 1ll*a.x*b.x+1ll*a.y*b.y;
	}
    friend inline bool operator <(const pt &a,const pt &b){
        return (a.x==b.x)?a.y<b.y:a.x<b.x;
    }
};
long double eps=1e-10;
void solve(){
	cin>>x1>>y1>>z1>>p1>>q1;
	pt v1=pt(p1,q1),A=pt(x1,y1);
	cin>>x2>>y2>>z2>>p2>>q2;
	pt v2=pt(p2,q2),B=pt(x2,y2);
	x2-=x1,y2-=y1,z2-=z1;
	pt C=A-B;
//	cout<<C.x<<" "<<C.y<<" "<<v1.x<<" "<<v1.y<<'\n';
	if((C^v1)==0&&(C^v2)==0)puts("2");
	else{
		int a1=p1,b1=q1,c1=0;
		int a2=-p2,b2=-q2,c2=1ll*p2*x2+1ll*q2*y2;
		if(a1*b2-a2*b1==0){
			puts("4");return;
		}
		long double xx=1.0*(b1*c2+b2*c1)/(a1*b2-a2*b1);
		long double yy;
		if(b1==0){
			yy=-1.0*(a2*xx+c2)/b2;
		}
		else yy=-1.0*(a1*xx+c1)/b1;
		//cout<<xx<<" "<<yy<<'\n';
		long double del=z2*z2-4*(xx*xx-x2*xx+yy*yy-y2*yy);
		//cout<<del<<'\n';
		if(del>=0&&(fabs(xx-x1)>eps&&fabs(yy-y2)>eps)){
			puts("3");
		}
		else puts("4");
	}
}

signed main(){
	#ifdef Stargazer
	freopen("1.in","r",stdin);
	#endif
	int T;cin>>T;
	while(T--)solve();
}

詳細信息

Test #1:

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

input:

2
-1 -1 3
1 1
2 2 3
2 2
5 5 1
3 0
7 6 -2
1 -2

output:

4
3

result:

ok 2 number(s): "4 3"

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3536kb

input:

100
-13 -5 -7
-19 19
-19 -13 0
-7 15
-20 20 19
-17 18
20 -20 -1
18 -19
-18 15 -14
-19 18
19 -20 6
20 -19
-12 9 1
7 -16
-13 -14 -8
8 -13
-19 16 9
20 -19
19 -18 -11
19 -18
19 20 -8
12 20
-11 -9 18
-19 -18
8 11 -13
12 -18
18 13 8
4 -18
-16 20 17
-19 18
20 -18 -3
20 -19
-17 -20 -5
-18 -19
19 16 15
19 20...

output:

4
4
4
4
4
4
3
4
4
4
3
4
4
3
3
4
3
4
4
4
4
4
4
4
4
4
4
4
4
3
4
4
4
4
4
4
4
4
4
4
4
4
4
4
3
4
4
4
4
4
4
4
3
4
4
4
3
4
4
4
4
4
4
4
3
4
3
4
4
4
4
4
4
4
4
4
4
4
4
3
4
4
4
4
4
4
4
3
4
4
3
4
4
4
4
4
4
4
4
4

result:

wrong answer 29th numbers differ - expected: '3', found: '4'