QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#711740 | #9227. Henry the Plumber | jimmyywang | WA | 1ms | 3644kb | C++14 | 1.6kb | 2024-11-05 13:13:12 | 2024-11-05 13:13:14 |
Judging History
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(a.z==b.z?"4":"3");continue;}
if(x.x*y.y==x.y*y.x){puts(a.z==b.z?"4":"3");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;
double m=a.z,n=b.z,r=(a.z+b.z)/2;
if(r*r-(m+n)*r+m*n+((a.x-p.x)*(b.x-p.x)+(a.y-p.y)*(b.y-p.y))<=0)puts("3");
else puts("4");
}
return 0;
}
/*
8 11 -13
12 -18
18 13 8
4 -18
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3560kb
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: 0ms
memory: 3644kb
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: 0ms
memory: 3632kb
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: 3632kb
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 3 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 3 3 3 4 4
result:
wrong answer 96th numbers differ - expected: '4', found: '3'