QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#49670 | #4418. Laser Alarm | zzxzzx123 | WA | 6ms | 3832kb | C++17 | 2.4kb | 2022-09-22 11:40:22 | 2022-09-22 11:41:10 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=60;
struct node{
int x[4],y[4],z[4];
}e[N];
struct node get(int a,int b,int c,int x,int y,int z){
return {b*z-c*y,-a*z+c*x,a*y-b*x};
}
int get2(int a,int b,int c,int x,int y,int z){
return a*x+b*y+c*z;
}
void sol(int& x,int& y,int& z,int i,int ii,int j,int jj)
{
x=e[i].x[ii]-e[j].x[jj];
y=e[i].y[ii]-e[j].y[jj];
z=e[i].z[ii]-e[j].z[jj];
}
bool check(int i,int j,int k,int xn,int yn,int zn){
for(int ii=1;ii<=2;ii++){
for(int jj=1;jj<=2;jj++){
int x,y,z;
sol(x,y,z,i,ii,k,jj);
if(get2(x,y,z,xn,yn,zn)!=0) return false;
}
}
for(int ii=1;ii<=2;ii++){
for(int jj=1;jj<=2;jj++){
int x,y,z;
sol(x,y,z,j,ii,k,jj);
if(get2(x,y,z,xn,yn,zn)!=0) return false;
}
}
return true;
}
bool check2(int x,int y,int z,int a,int b,int c){
if(b*x==a*y){
if(y*c==b*z){
return true;
}
}
return false;
}
int main(){
int t;
scanf("%d",&t);
while(t--)
{
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%d%d%d%d%d%d",&e[i].x[1],&e[i].y[1],&e[i].z[1],&e[i].x[2],&e[i].y[2],&e[i].z[2]);
e[i].x[0]=e[i].x[1]-e[i].x[2];
e[i].y[0]=e[i].y[1]-e[i].y[2];
e[i].z[0]=e[i].z[1]-e[i].z[2];
}
int ans=0;
for(int i=1;i<=n;i++){
for(int j=i+1;j<=n;j++){
int res=2;
int a=e[i].x[0],b=e[i].y[0],c=e[i].z[0];
int x=e[j].x[1]-e[i].x[2],y=e[j].y[1]-e[i].y[2],z=e[j].z[1]-e[i].z[2];
int xn=b*z-c*y,yn=-a*z+c*x,zn=a*y-b*x;
if(!xn&&!yn&&!zn)
{
int x=e[j].x[2]-e[i].x[2],y=e[j].y[2]-e[i].y[2],z=e[j].z[2]-e[i].z[2];
xn=b*z-c*y,yn=-a*z+c*x,zn=a*y-b*x;
}
// cout<<i<<" "<<j<<" debug "<<xn<<' '<<yn<<" "<<zn<<endl;
if(xn||yn||zn)
{
for(int k=1;k<=n;k++){
if(k==i||k==j) continue;
if(check(i,j,k,xn,yn,zn)){
res++;
// cout<<i<<" "<<j<<" "<<k<<endl;
}
}
ans=max(ans,res);
}
else {
//那么就是一条直线
for(int k=1;k<=n;k++){
if(k==i||k==j) continue;
int xx=e[k].x[2]-e[i].x[2],yy=e[k].y[2]-e[i].y[2],zz=e[k].z[2]-e[i].z[2];
if(check2(xx,yy,zz,a,b,c))
{
xx=e[k].x[1]-e[i].x[2],yy=e[k].y[1]-e[i].y[2],zz=e[k].z[1]-e[i].z[2];
if(check2(xx,yy,zz,a,b,c)){
res++;
}
}
}
ans=max(ans,res);
}//如果是一条直线的话
}//不相同
}
printf("%d\n",ans);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 6ms
memory: 3832kb
input:
10 50 94 57 39 12 69 59 86 46 44 17 32 83 35 86 71 47 41 50 68 93 71 54 28 25 92 74 2 30 60 86 87 52 54 32 17 88 51 63 96 23 12 69 1 82 85 20 9 90 25 72 42 49 4 52 30 86 94 93 43 34 10 45 30 85 32 75 84 37 71 37 78 19 28 30 7 40 10 77 5 68 86 83 3 41 71 73 8 86 69 48 65 11 6 49 64 50 61 2 24 60 11 9...
output:
2 2 2 2 2 2 2 3 50 50
result:
wrong answer 1st lines differ - expected: '33', found: '2'