QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#820165#4418. Laser Alarmlqt1217WA 418ms3884kbC++141.9kb2024-12-18 19:57:332024-12-18 19:57:34

Judging History

This is the latest submission verdict.

  • [2024-12-18 19:57:34]
  • Judged
  • Verdict: WA
  • Time: 418ms
  • Memory: 3884kb
  • [2024-12-18 19:57:33]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
const int N= 305;
#define int long long
struct node {
	int x, y, z;
}a[N], b[N], v[N];
int tot;

int calc(node pl,int det,node e){
    if(e.x*pl.x+e.y*pl.y+e.z*pl.z==det) return 0;
    if(det-e.x*pl.x+e.y*pl.y<e.z*pl.z) return 1;
    else return 2;
}

inline bool check(node pl,int det,node e1,node e2){
    if(!calc(pl,det,e1)||!calc(pl,det,e2)) return true;
    else return calc(pl,det,e1)!=calc(pl,det,e2);
}
bool cl(node &x) {
    if(x.x==0&&x.y==0&&x.z==0) return true;
    int t= __gcd(abs(x.x), __gcd(abs(x.y), abs(x.z)));
    x.x/= t, x.y/= t, x.z/= t;
    if(x.x< 0) x.x= -x.x, x.y= -x.y, x.z= -x.z;
    if(x.x==0&&x.y<0) x.y=-x.y,x.z=-x.z;
    if(x.x==0&&x.y==0&&x.z<0) x.z=-x.z;

    return false;
}
signed main() {
	int T;
	cin>> T;
	while(T-- ) {
		int n;
		scanf("%lld", &n);
		tot= 0;
		for(int i= 1; i<= n; i++ )
			scanf("%lld%lld%lld%lld%lld%lld", &a[i].x, &a[i].y, &a[i].z, &b[i].x, &b[i].y, &b[i].z), v[++ tot]= a[i], v[++ tot]= b[i];
		int mx= 0;
        v[++tot]={1,1,1};
        v[++tot]={1,1,2};
        v[++tot]={1,2,1};
        v[++tot]={2,1,1};
		for(int i= 1; i<= tot; i++ )
			for(int j= i+ 1; j<= tot; j++ )
				for(int k= j+ 1; k<= tot; k++ ) {
					node x= {v[j].x- v[i].x, v[j].y- v[i].y, v[j].z- v[i].z};
					node y= {v[k].x- v[j].x, v[k].y- v[j].y, v[k].z- v[j].z};
                    if(cl(x)||cl(y)) continue;
                    if(x.x==y.x&&x.y==y.y&&x.z==y.z) continue;
					int cnt= 0;
					node c= {x.y* y.z- x.z* y.y, x.z* y.x- x.x* y.z, x.x* y.y- x.y* y.x};
					//cout<< c.x<< ' '<< c.y<< ' '<< c.z<< endl;
                    int det=c.x*v[i].x+c.y*v[i].y+c.z*v[i].z;

					for(int l= 1; l<= n; l++ )
					if(check(c,det,a[l],b[l])) cnt++ ;
					
                    mx= max(mx, cnt);
				}
		printf("%lld\n", mx);
	}
	return 0;
}

/*
1
4
1 1 1 1 1 2
1 1 10 1 1 11
1 10 1 1 10 2
10 1 1 10 1 2
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 418ms
memory: 3884kb

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:

35
35
36
37
40
35
34
34
50
50

result:

wrong answer 1st lines differ - expected: '33', found: '35'