QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#711494 | #9227. Henry the Plumber | jimmyywang | WA | 0ms | 3632kb | C++14 | 1.4kb | 2024-11-05 11:28:34 | 2024-11-05 11:28:34 |
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("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.x,x.y},D=B+(vec2){y.x,y.y};
vec2 p=intsec(A,C,B,D);
if(Dot(A-p,B-p)>0)puts("4");else puts("3");
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3632kb
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: 3568kb
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 3 4 4 4 4 3 4 4 4 4 3 4 4 4 4 4 4 3 4 4 3 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 3 4 4 3 4 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 4 4 4 4 4 3 4 4 4 4 4 4 3 4 4 4 3
result:
wrong answer 6th numbers differ - expected: '4', found: '3'