QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#711498#9227. Henry the PlumberjimmyywangWA 0ms3628kbC++141.5kb2024-11-05 11:30:462024-11-05 11:30:46

Judging History

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

  • [2024-11-05 11:30:46]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3628kb
  • [2024-11-05 11:30:46]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i,a,b) for(ll i=a;i<=b;i++)
ll rd(){
    ll x=0,f=1;char c=getchar();
    while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
    while(isdigit(c)){x=x*10+c-'0';c=getchar();}
    return x*f;
}
#define d rd()
struct vec{double x,y,z;};
vec operator + (vec a,vec b){return {a.x+b.x,a.y+b.y,a.z+b.z};}
vec operator - (vec a,vec b){return {a.x-b.x,a.y-b.y,a.z-b.z};}
double Dot(vec a,vec b){return a.x*b.x+a.y*b.y+a.z*b.z;}
struct vec2{double x,y;};
vec2 operator + (vec2 a,vec2 b){return {a.x+b.x,a.y+b.y};}
vec2 operator - (vec2 a,vec2 b){return {a.x-b.x,a.y-b.y};}
vec2 operator / (vec2 a,double k){return {a.x/k,a.y/k};}
double Dot(vec2 a,vec2 b){return a.x*b.x+a.y*b.y;}
double Cross(vec2 a,vec2 b){return a.x*b.y-a.y*b.x;}
vec2 intsec(vec2 A,vec2 B,vec2 C,vec2 D){
	double s1=Cross(B-A,C-A),s2=Cross(B-A,D-A);
	return (vec2){s2*C.x-s1*D.x,s2*C.y-s1*D.y}/(s2-s1);
}
vec a,b,x,y;
int main(){
    ll T=d;while(T--){
        a={d,d,d},x={d,d,0};
        b={d,d,d},y={d,d,0};
        if(Dot(x,a-b)==0&&Dot(y,a-b)==0){puts("2");continue;}
        if(Dot(x,a-b)==0||Dot(y,a-b)==0){puts("3");continue;}
        if(x.x*y.y==x.y*y.x){puts("4");continue;}
        vec2 A={a.x,a.y},B={b.x,b.y},C=A+(vec2){x.y,-x.x},D=B+(vec2){y.y,-y.x};
        vec2 p=intsec(A,C,B,D);
        // cout<<p.x<<" "<<p.y<<endl;
        if(Dot(A-p,B-p)>0)puts("4");else puts("3");
    }
    return 0;
}
/*
19 20 -8
12 20
-11 -9 18
-19 -18
*/

詳細信息

Test #1:

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

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: 0ms
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
4
4
4
4
4
4
4
3
3
4
4
4
4
4
4
4
4
4
4
4
4
4
3
4
3
4
4
4
4
4
4
4
4
4
4
4
4
4
3
4
4
4
4
4
3
4
4
4
4
4
3
4
4
4
4
4
4
4
4
4
4
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:

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