QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#690497#9227. Henry the PlumberStargazerWA 1ms3672kbC++172.2kb2024-10-30 22:37:542024-10-30 22:37:56

Judging History

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

  • [2024-10-30 22:37:56]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3672kb
  • [2024-10-30 22:37:54]
  • 提交

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-x2)>eps||fabs(yy-y2)>eps||z2>eps)){
			puts("3");
		}
		else puts("4");
	}
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 0
Accepted
time: 1ms
memory: 3624kb

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
3
3
3
4
4
4
4
4
4
4
4
4
4
4
4
4
3
4
4
4
4
4
3
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
3
4
3
4
4
4
4
4
4
4
4
4

result:

ok 100 numbers

Test #3:

score: 0
Accepted
time: 1ms
memory: 3604kb

input:

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

output:

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

result:

ok 100 numbers

Test #4:

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

input:

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

output:

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

result:

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