QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#106946#6412. Classical Geometry Problembulijiojiodibuliduo#AC ✓38ms3760kbC++12.6kb2023-05-19 21:02:502023-05-19 21:02:54

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-19 21:02:54]
  • 评测
  • 测评结果:AC
  • 用时:38ms
  • 内存:3760kb
  • [2023-05-19 21:02:50]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef basic_string<int> BI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

const db EPS = 1e-9;
const db PI = acos(-1.0);
  
inline int sign(db a) { return a < -EPS ? -1 : a > EPS; }
  
inline int cmp(db a, db b){ return sign(a-b); }
  
struct P {
	db x, y;
	P() {}
	P(db _x, db _y) : x(_x), y(_y) {}
	P operator+(P p) { return {x + p.x, y + p.y}; }
	P operator-(P p) { return {x - p.x, y - p.y}; }
	P operator*(db d) { return {x * d, y * d}; }
	P operator/(db d) { return {x / d, y / d}; }
 
	bool operator<(P p) const { 
		int c = cmp(x, p.x);
		if (c) return c == -1;
		return cmp(y, p.y) == -1;
	}
 
	bool operator==(P o) const{
		return cmp(x,o.x) == 0 && cmp(y,o.y) == 0;
	}
 
	db dot(P p) { return x * p.x + y * p.y; }
	db det(P p) { return x * p.y - y * p.x; }
	 
	db distTo(P p) { return (*this-p).abs(); }
	db alpha() { return atan2(y, x); }
	void read() { cin>>x>>y; }
	void write() {cout<<"("<<x<<","<<y<<")"<<endl;}
	db abs() { return sqrt(abs2());}
	db abs2() { return x * x + y * y; }
	P rot90() { return P(-y,x);}
	P unit() { return *this/abs(); }
	int quad() const { return sign(y) == 1 || (sign(y) == 0 && sign(x) >= 0); }
	P rot(db an){ return {x*cos(an)-y*sin(an),x*sin(an) + y*cos(an)}; }
};
  
struct L{ //ps[0] -> ps[1]
	P ps[2];
	P dir_;
	P& operator[](int i) { return ps[i]; }
	P dir() { return dir_; }
	L (P a,P b) {
		ps[0]=a;
		ps[1]=b;
		dir_ = (ps[1]-ps[0]).unit();
	}
	bool include(P p) { return sign((dir_).det(p - ps[0])) > 0; }
	L push(){ // push eps outward
		const double eps = 1e-8;
		P delta = (ps[1] - ps[0]).rot90().unit() * eps;
		return {ps[0] + delta, ps[1] + delta};
	}
};

#define cross(p1,p2,p3) ((p2.x-p1.x)*(p3.y-p1.y)-(p3.x-p1.x)*(p2.y-p1.y))
#define crossOp(p1,p2,p3) sign(cross(p1,p2,p3))
  
bool chkLL(P p1, P p2, P q1, P q2) {
	db a1 = cross(q1, q2, p1), a2 = -cross(q1, q2, p2);
	return sign(a1+a2) != 0;
}
 
P isLL(P p1, P p2, P q1, P q2) {
	db a1 = cross(q1, q2, p1), a2 = -cross(q1, q2, p2);
	return (p1 * a2 + p2 * a1) / (a1 + a2);
}
  
P isLL(L l1,L l2){ return isLL(l1[0],l1[1],l2[0],l2[1]); }
  
bool intersect(db l1,db r1,db l2,db r2){
	if(l1>r1) swap(l1,r1); if(l2>r2) swap(l2,r2); 
	return !( cmp(r1,l2) == -1 || cmp(r2,l1) == -1 );
}
  
bool isSS(P p1, P p2, P q1, P q2){
	return intersect(p1.x,p2.x,q1.x,q2.x) && intersect(p1.y,p2.y,q1.y,q2.y) && 
	crossOp(p1,p2,q1) * crossOp(p1,p2,q2) <= 0 && crossOp(q1,q2,p1)
			* crossOp(q1,q2,p2) <= 0;
}
  
bool isSS_strict(P p1, P p2, P q1, P q2){
	return crossOp(p1,p2,q1) * crossOp(p1,p2,q2) < 0 && crossOp(q1,q2,p1)
			* crossOp(q1,q2,p2) < 0;
}
  
bool isMiddle(db a, db m, db b) {
	return sign(a - m) == 0 || sign(b - m) == 0 || (a < m != b < m);
}
  
bool isMiddle(P a, P m, P b) {
	return isMiddle(a.x, m.x, b.x) && isMiddle(a.y, m.y, b.y);
}
  
bool onSeg(P p1, P p2, P q){
	return crossOp(p1,p2,q) == 0 && isMiddle(p1, q, p2);
}
 
bool onSeg_strict(P p1, P p2, P q){
	return crossOp(p1,p2,q) == 0 && sign((q-p1).dot(p1-p2)) * sign((q-p2).dot(p1-p2)) < 0;
}
  
P proj(P p1, P p2, P q) {
	P dir = p2 - p1;
	return p1 + dir * (dir.dot(q - p1) / dir.abs2());
}
  
P reflect(P p1, P p2, P q){
	return proj(p1,p2,q) * 2 - q;
}
  
db nearest(P p1,P p2,P q){
	if (p1==p2) return p1.distTo(q);
	P h = proj(p1,p2,q);
	if(isMiddle(p1,h,p2))
		return q.distTo(h);
	return min(p1.distTo(q),p2.distTo(q));
}
  
db disSS(P p1, P p2, P q1, P q2){
	if(isSS(p1,p2,q1,q2)) return 0;
	return min(min(nearest(p1,p2,q1),nearest(p1,p2,q2)), min(nearest(q1,q2,p1),nearest(q1,q2,p2)));
}
  
db rad(P p1,P p2){
	return atan2l(p1.det(p2),p1.dot(p2));
}
  
db incircle(P p1, P p2, P p3){
	db A = p1.distTo(p2);
	db B = p2.distTo(p3);
	db C = p3.distTo(p1);
	return sqrtl(A*B*C/(A+B+C));
}
  
//polygon
  
db area(vector<P> ps){
	db ret = 0; rep(i,0,ps.size()) ret += ps[i].det(ps[(i+1)%ps.size()]); 
	return ret/2;
}
  
int contain(vector<P> ps, P p){ //2:inside,1:on_seg,0:outside
	int n = ps.size(), ret = 0; 
	rep(i,0,n){
		P u=ps[i],v=ps[(i+1)%n];
		if(onSeg(u,v,p)) return 1;
		if(cmp(u.y,v.y)<=0) swap(u,v);
		if(cmp(p.y,u.y) >0 || cmp(p.y,v.y) <= 0) continue;
		ret ^= crossOp(p,u,v) > 0;
	}
	return ret*2;
}
  
vector<P> convexHull(vector<P> ps) {
	int n = ps.size(); if(n <= 1) return ps;
	sort(ps.begin(), ps.end());
	vector<P> qs(n * 2); int k = 0;
	for (int i = 0; i < n; qs[k++] = ps[i++]) 
		while (k > 1 && crossOp(qs[k - 2], qs[k - 1], ps[i]) <= 0) --k;
	for (int i = n - 2, t = k; i >= 0; qs[k++] = ps[i--])
		while (k > t && crossOp(qs[k - 2], qs[k - 1], ps[i]) <= 0) --k;
	qs.resize(k - 1);
	return qs;
}
  
vector<P> convexHullNonStrict(vector<P> ps) {
	//caution: need to unique the Ps first
	int n = ps.size(); if(n <= 1) return ps;
	sort(ps.begin(), ps.end());
	vector<P> qs(n * 2); int k = 0;
	for (int i = 0; i < n; qs[k++] = ps[i++]) 
		while (k > 1 && crossOp(qs[k - 2], qs[k - 1], ps[i]) < 0) --k;
	for (int i = n - 2, t = k; i >= 0; qs[k++] = ps[i--])
		while (k > t && crossOp(qs[k - 2], qs[k - 1], ps[i]) < 0) --k;
	qs.resize(k - 1);
	return qs;
}
  
db convexDiameter(vector<P> ps){
	int n = ps.size(); if(n <= 1) return 0;
	int is = 0, js = 0; rep(k,1,n) is = ps[k]<ps[is]?k:is, js = ps[js] < ps[k]?k:js;
	int i = is, j = js;
	db ret = ps[i].distTo(ps[j]);
	do{
		if((ps[(i+1)%n]-ps[i]).det(ps[(j+1)%n]-ps[j]) >= 0)
			(++j)%=n;
		else
			(++i)%=n;
		ret = max(ret,ps[i].distTo(ps[j]));
	}while(i!=is || j!=js);
	return ret;
}
  
vector<P> convexCut(const vector<P>&ps, P q1, P q2) {
	vector<P> qs;
	int n = ps.size();
	rep(i,0,n){
		P p1 = ps[i], p2 = ps[(i+1)%n];
		int d1 = crossOp(q1,q2,p1), d2 = crossOp(q1,q2,p2);
		if(d1 >= 0) qs.pb(p1);
		if(d1 * d2 < 0) qs.pb(isLL(p1,p2,q1,q2));
	}
	return qs;
}
  
//min_dist
  
db min_dist(vector<P>&ps,int l,int r){
	if(r-l<=5){
		db ret = 1e100;
		rep(i,l,r) rep(j,l,i) ret = min(ret,ps[i].distTo(ps[j]));
		return ret;
	}
	int m = (l+r)>>1;
	db ret = min(min_dist(ps,l,m),min_dist(ps,m,r));
	vector<P> qs; rep(i,l,r) if(abs(ps[i].x-ps[m].x)<= ret) qs.pb(ps[i]);
	sort(qs.begin(), qs.end(),[](P a,P b) -> bool {return a.y<b.y; });
	rep(i,1,qs.size()) for(int j=i-1;j>=0&&qs[j].y>=qs[i].y-ret;--j)
		ret = min(ret,qs[i].distTo(qs[j]));
	return ret;
}
  
int type(P o1,db r1,P o2,db r2){
	db d = o1.distTo(o2);
	if(cmp(d,r1+r2) == 1) return 4;
	if(cmp(d,r1+r2) == 0) return 3;
	if(cmp(d,abs(r1-r2)) == 1) return 2;
	if(cmp(d,abs(r1-r2)) == 0) return 1;
	return 0;
}
  
vector<P> isCL(P o,db r,P p1,P p2){
	if (cmp(abs((o-p1).det(p2-p1)/p1.distTo(p2)),r)>0) return {};
	db x = (p1-o).dot(p2-p1), y = (p2-p1).abs2(), d = x * x - y * ((p1-o).abs2() - r*r);
	d = max(d,(db)0.0); P m = p1 - (p2-p1)*(x/y), dr = (p2-p1)*(sqrt(d)/y);
	return {m-dr,m+dr}; //along dir: p1->p2
}
  
vector<P> isCC(P o1, db r1, P o2, db r2) { //need to check whether two circles are the same
	db d = o1.distTo(o2); 
	if (cmp(d, r1 + r2) == 1) return {};
	if (cmp(d,abs(r1-r2))==-1) return {};
	d = min(d, r1 + r2);
	db y = (r1 * r1 + d * d - r2 * r2) / (2 * d), x = sqrt(r1 * r1 - y * y);
	P dr = (o2 - o1).unit();
	P q1 = o1 + dr * y, q2 = dr.rot90() * x;
	return {q1-q2,q1+q2};//along circle 1
}
  
vector<P> tanCP(P o, db r, P p) {
	db x = (p - o).abs2(), d = x - r * r;
	if (sign(d) <= 0) return {}; // on circle => no tangent
	P q1 = o + (p - o) * (r * r / x);
	P q2 = (p - o).rot90() * (r * sqrt(d) / x);
	return {q1-q2,q1+q2}; //counter clock-wise
}
  
// extanCC, intanCC : -r2, tanCP : r2 = 0
vector<pair<P, P>> tanCC(P o1, db r1, P o2, db r2) {
	P d = o2 - o1;
	db dr = r1 - r2, d2 = d.abs2(), h2 = d2 - dr * dr;
	if (sign(d2) == 0|| sign(h2) < 0) return {};
	h2 = max(0.0, h2);
	vector<pair<P, P>> ret;
	for (db sign : {-1, 1}) {
		P v = (d * dr + d.rot90() * sqrt(h2) * sign) / d2;
		ret.push_back({o1 + v * r1, o2 + v * r2});
	}
	if (sign(h2) == 0) ret.pop_back();
	return ret;
}
  
db areaCT(db r, P p1, P p2){
	vector<P> is = isCL(P(0,0),r,p1,p2);
	if(is.empty()) return r*r*rad(p1,p2)/2;
	bool b1 = cmp(p1.abs2(),r*r) == 1, b2 = cmp(p2.abs2(), r*r) == 1;
	if(b1 && b2){
		P md=(is[0]+is[1])/2;
		if(sign((p1-md).dot(p2-md)) <= 0) 
			return r*r*(rad(p1,is[0]) + rad(is[1],p2))/2 + is[0].det(is[1])/2;
		else return r*r*rad(p1,p2)/2;
	}
	if(b1) return (r*r*rad(p1,is[0]) + is[0].det(p2))/2;
	if(b2) return (p1.det(is[1]) + r*r*rad(is[1],p2))/2;
	return p1.det(p2)/2;
}
  
bool parallel(L l0, L l1) { return sign( l0.dir().det( l1.dir() ) ) == 0; }
  
bool sameDir(L l0, L l1) { return parallel(l0, l1) && sign(l0.dir().dot(l1.dir()) ) == 1; }
  
bool cmp (P a,  P b) {
	if (a.quad() != b.quad()) {
		return a.quad() < b.quad();
	} else {
		return sign( a.det(b) ) > 0;
	}
}
  
bool operator < (L l0, L l1) {
	if (sameDir(l0, l1)) {
		return l1.include(l0[0]);
	} else {
		return cmp( l0.dir(), l1.dir() );
	}
}
  
bool check(L u, L v, L w) { 
	return w.include(isLL(u,v)); 
}
  
vector<P> halfPlaneIS(vector<L> &l) {
	sort(l.begin(), l.end());
	deque<L> q;
	for (int i = 0; i < (int)l.size(); ++i) {
		if (i && sameDir(l[i], l[i - 1])) continue;
		while (q.size() > 1 && !check(q[q.size() - 2], q[q.size() - 1], l[i])) q.pop_back();
		while (q.size() > 1 && !check(q[1], q[0], l[i])) q.pop_front();
		q.push_back(l[i]);
	}
	while (q.size() > 2 && !check(q[q.size() - 2], q[q.size() - 1], q[0])) q.pop_back();
	while (q.size() > 2 && !check(q[1], q[0], q[q.size() - 1])) q.pop_front();
	vector<P> ret;
	for (int i = 0; i < (int)q.size(); ++i) ret.push_back(isLL(q[i], q[(i + 1) % q.size()]));
	return ret;
}
 
P inCenter(P A, P B, P C) {
	double a = (B - C).abs(), b = (C - A).abs(), c = (A - B).abs();
	return (A * a + B * b + C * c) / (a + b + c);
}
 
P circumCenter(P a, P b, P c) { 
	P bb = b - a, cc = c - a;
	double db = bb.abs2(), dc = cc.abs2(), d = 2 * bb.det(cc);
	return a - P(bb.y * dc - cc.y * db, cc.x * db - bb.x * dc) / d;
}
 
P othroCenter(P a, P b, P c) { 
	P ba = b - a, ca = c - a, bc = b - c;
	double Y = ba.y * ca.y * bc.y,
	A = ca.x * ba.y - ba.x * ca.y,
	x0 = (Y + ca.x * ba.y * b.x - ba.x * ca.y * c.x) / A,
	y0 = -ba.x * (x0 - c.x) / ba.y + ca.y;
	return {x0, y0};
}


db sqr(db x){ return x*x; }

struct P3{
    db x,y,z;
    P3() {}
    P3(db x, db y, db z):x(x),y(y),z(z) {}
    P3 operator+(P3 o){ return {x+o.x,y+o.y,z+o.z}; }
    P3 operator-(P3 o){ return {x-o.x,y-o.y,z-o.z}; }
    db operator*(P3 o){ return x*o.x+y*o.y+z*o.z; }
    P3 operator^(P3 o){ return {y*o.z-z*o.y,z*o.x-x*o.z,x*o.y-y*o.x}; }
    P3 operator*(db o){ return {x*o,y*o,z*o}; }
    P3 operator/(db o){ return {x/o,y/o,z/o}; }

    db abs2(){ return sqr(x) + sqr(y) + sqr(z); }
    db abs(){ return sqrt(abs2()); }

    P3 norm(){ return *this / abs(); } 
    bool operator<(P3 o){
        if(cmp(x,o.x) != 0) return x < o.x;
        if(cmp(y,o.y) != 0) return y < o.y;
        return cmp(z,o.z) == -1;
    }
    bool operator==(P3 o){
        return cmp(x,o.x) == 0 && cmp(y,o.y) == 0 && cmp(z,o.z) == 0;
    }
    void read(){
        cin>>x>>y>>z;
    }
    void print(){
        printf("%lf,%lf,%lf\n",x,y,z);
    }
};


db dis(db x,db y,db z) {
	return sqrt(x*x+y*y+z*z);
}
void solve() {
	int x,y,z;
	scanf("%d%d%d",&x,&y,&z);
	int fx=0,fy=0,fz=0;
	if (x>127) x=255-x,fx=1;
	if (y>127) y=255-y,fy=1;
	if (z>127) z=255-z,fz=1;
	db scal=255./(255-z);
	vector<pair<array<int,3>,db>> ans;
	auto solve2=[&](db x, db y) {
		int gx=0,gy=0;
		if (x>=127.5) x=255-x,gx=1;
		if (y>=127.5) y=255-y,gy=1;
		db s2=255./(255-y);
		ans.pb(mp(array<int,3>{fx^gx,fy^gy,fz},1000.));
		ans.pb(mp(array<int,3>{1^fx^gx,fy^gy,fz},x*s2));
		ans.pb(mp(array<int,3>{fx^gx,1^fy^gy,fz},dis(x*(s2-1),y,0)));
	};
	solve2(x*scal,y*scal);
	ans.pb(mp(array<int,3>{fx,fy,1^fz},dis(x*(scal-1),y*(scal-1),z)));
	printf("%d\n",SZ(ans));
	P3 o(0,0,0);
	for (auto [p,t]:ans) {
		printf("%d %d %d %.10f\n",255*p[0],255*p[1],255*p[2],t);
		/*P3 x(255*p[0],255*p[1],255*p[2]);
		if (o==x) {

		} else {
			P3 v=(x-o); 
			db l=v.abs();
			o=o+v/l*min(t,l);
			o.print();
		}*/
	}
}

int _;
int main() {
	for (scanf("%d",&_);_;_--) {
		solve();
	}
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3652kb

input:

3
105 255 175
174 174 174
0 0 0

output:

4
255 255 255 1000.0000000000
0 255 255 102.0000000000
255 0 255 0.0000000000
0 255 0 93.2952303175
4
255 255 255 1000.0000000000
0 255 255 222.0967741935
255 0 255 157.4191668372
255 255 0 96.9774205427
4
0 0 0 1000.0000000000
255 0 0 0.0000000000
0 255 0 0.0000000000
0 0 255 0.0000000000

result:

ok ok (3 test cases)

Test #2:

score: 0
Accepted
time: 29ms
memory: 3704kb

input:

10000
250 128 13
1 245 2
88 183 138
179 69 194
153 246 33
255 119 192
233 30 108
26 208 33
53 162 189
225 130 10
202 137 121
152 198 25
49 165 180
228 56 30
74 18 14
6 115 31
168 242 206
90 238 139
44 103 60
16 21 190
229 209 68
41 171 181
39 74 73
181 96 18
234 95 70
75 174 84
101 16 44
202 249 80
...

output:

4
255 0 0 1000.0000000000
0 0 0 10.0393700787
255 255 0 121.2715624817
255 255 255 14.6838725235
4
0 255 0 1000.0000000000
255 255 0 1.0493827160
0 0 0 10.0791367278
0 255 255 2.0015772812
4
255 0 255 1000.0000000000
0 0 255 177.0833333333
255 255 255 148.4794025055
0 255 0 151.5973736748
4
255 0 25...

result:

ok ok (10000 test cases)

Test #3:

score: 0
Accepted
time: 38ms
memory: 3660kb

input:

10000
90 173 87
39 251 59
39 43 150
106 29 130
52 55 180
236 225 70
171 15 48
92 133 240
182 226 10
126 139 105
196 7 204
32 131 193
27 96 218
67 29 33
159 9 251
130 111 243
226 69 39
198 131 80
108 169 147
45 36 170
76 138 251
55 235 186
224 165 48
51 133 173
225 14 226
234 70 139
178 92 174
138 24...

output:

4
255 255 0 1000.0000000000
0 255 0 231.2790697674
255 0 0 168.0317095643
0 255 255 107.4450618992
4
0 255 0 1000.0000000000
255 255 0 51.7968750000
0 0 0 5.3103560920
0 255 255 60.1687013387
4
0 0 255 1000.0000000000
255 0 255 92.9439252336
0 255 255 77.8042977724
0 0 0 112.5890758466
4
255 0 255 1...

result:

ok ok (10000 test cases)

Test #4:

score: 0
Accepted
time: 34ms
memory: 3596kb

input:

10000
186 217 161
76 0 116
246 159 161
32 245 65
206 120 71
217 76 204
109 255 245
157 59 192
55 35 87
27 147 199
190 134 31
169 64 105
5 27 255
161 2 35
244 255 232
253 106 199
28 151 129
50 24 20
172 236 234
74 51 150
179 68 178
69 42 192
152 1 23
177 169 71
216 190 125
136 223 193
255 168 49
74 2...

output:

4
255 255 255 1000.0000000000
0 255 255 143.0487804878
255 0 255 69.0097066267
255 255 0 104.6478487794
4
255 0 0 1000.0000000000
0 0 0 115.5755395683
255 255 0 0.0000000000
0 0 255 132.2068915792
4
255 0 255 1000.0000000000
0 0 255 23.9062500000
255 255 255 103.4017391773
255 255 0 109.5681482967
4...

result:

ok ok (10000 test cases)

Test #5:

score: 0
Accepted
time: 33ms
memory: 3656kb

input:

10000
26 6 234
114 6 172
198 19 173
214 204 1
104 186 218
199 182 82
47 240 186
223 240 143
184 99 164
184 155 37
185 4 114
49 253 17
239 214 37
0 231 38
73 245 212
121 102 155
86 234 219
157 173 216
236 46 65
103 67 130
27 253 105
83 105 197
81 93 254
47 206 225
207 110 24
38 119 248
76 243 180
10 ...

output:

4
0 0 255 1000.0000000000
255 0 255 29.0789473684
0 255 255 6.5808373008
0 0 0 21.1360920057
4
255 0 255 1000.0000000000
0 0 255 89.0963855422
255 255 255 9.4226842532
0 0 0 99.6175800241
4
255 0 255 1000.0000000000
0 0 255 94.3831168831
255 255 255 29.8625692407
255 0 0 86.8046127608
4
255 255 0 10...

result:

ok ok (10000 test cases)

Test #6:

score: 0
Accepted
time: 38ms
memory: 3720kb

input:

10000
122 50 52
152 12 229
149 135 184
140 164 193
2 251 109
180 33 217
241 225 126
33 165 94
57 163 242
85 164 132
179 131 197
185 186 185
216 145 74
95 203 40
158 236 193
245 97 111
144 61 52
9 67 157
44 113 152
132 82 110
130 182 33
96 168 202
10 184 228
173 243 124
198 29 180
196 15 47
153 63 54...

output:

4
255 0 0 1000.0000000000
0 0 0 135.0000000000
255 255 0 71.0666898830
0 0 255 62.0054941717
4
255 0 255 1000.0000000000
0 0 255 121.0368663594
255 255 255 14.7913083229
255 0 0 28.5414339392
4
0 0 255 1000.0000000000
255 0 255 165.7500000000
0 255 255 105.7860665279
255 255 0 94.1173759643
4
0 255 ...

result:

ok ok (10000 test cases)

Test #7:

score: 0
Accepted
time: 34ms
memory: 3696kb

input:

10000
218 94 126
189 17 30
100 251 196
67 123 128
157 60 0
161 139 95
179 210 67
98 91 45
186 227 63
242 172 226
173 1 24
66 118 98
194 75 112
189 176 43
243 226 174
112 93 67
202 143 142
117 216 97
108 179 239
161 97 91
233 111 216
110 231 208
195 20 203
43 24 22
189 205 79
98 167 102
230 139 185
1...

output:

4
255 255 0 1000.0000000000
0 255 0 100.3723404255
255 0 0 74.3527721715
255 0 255 160.0370833175
4
255 0 0 1000.0000000000
0 0 0 80.9134615385
255 255 0 20.2133336297
255 0 255 31.3460966913
4
255 255 255 1000.0000000000
0 255 255 127.5000000000
255 0 255 5.8183401455
0 255 0 66.2463785719
4
255 25...

result:

ok ok (10000 test cases)

Test #8:

score: 0
Accepted
time: 32ms
memory: 3700kb

input:

10000
58 139 199
227 23 87
52 111 207
249 83 64
55 125 147
142 246 229
118 194 7
164 16 252
59 36 140
143 180 64
167 127 108
202 51 10
172 6 150
28 149 45
72 217 154
236 88 23
4 226 232
225 109 37
172 245 69
190 112 71
81 40 143
124 38 213
124 112 178
169 61 176
180 125 234
1 63 157
51 215 59
75 216...

output:

4
0 0 255 1000.0000000000
255 0 255 127.5000000000
0 255 255 118.9104993562
0 255 0 66.8429087121
4
255 0 0 1000.0000000000
0 0 0 49.2413793103
255 255 0 35.5556488753
255 0 255 89.0006467100
4
0 255 255 1000.0000000000
255 255 255 119.4594594595
0 0 255 130.5946330913
0 0 0 55.7843840203
4
255 0 0 ...

result:

ok ok (10000 test cases)

Test #9:

score: 0
Accepted
time: 33ms
memory: 3740kb

input:

10000
154 183 17
8 28 144
3 227 218
175 43 0
209 191 38
123 96 107
56 179 204
230 197 204
188 100 217
43 189 158
161 254 191
83 240 178
150 193 187
123 122 48
157 207 135
103 84 235
62 53 66
77 2 234
237 56 156
219 127 51
184 225 70
138 102 218
53 203 153
39 98 75
171 45 134
159 215 212
128 35 190
1...

output:

4
255 255 0 1000.0000000000
0 255 0 155.1506024096
255 0 0 90.2997133611
255 255 255 19.1701564407
4
0 0 255 1000.0000000000
255 0 255 17.5862068966
0 255 255 49.7011086378
0 0 0 113.2469339786
4
0 255 255 1000.0000000000
255 255 255 4.0263157895
0 0 255 32.7563760194
0 255 0 37.3074195400
4
255 0 0...

result:

ok ok (10000 test cases)

Test #10:

score: 0
Accepted
time: 35ms
memory: 3684kb

input:

10000
250 227 91
46 34 201
210 87 230
102 2 191
107 0 185
104 203 241
250 164 144
40 123 155
61 164 38
200 197 253
155 124 18
219 173 90
127 124 225
217 94 50
242 198 116
227 79 191
120 136 155
184 151 174
45 122 243
248 142 31
31 154 253
152 165 224
238 39 128
165 134 229
162 220 33
61 111 11
205 1...

output:

4
255 255 0 1000.0000000000
0 255 0 9.3750000000
255 0 0 43.5659984037
255 255 255 92.3584469665
4
0 0 255 1000.0000000000
255 0 255 70.2395209581
0 255 255 44.7407628212
0 0 0 56.1441117406
4
255 0 255 1000.0000000000
0 0 255 80.2447552448
255 255 255 101.1196942606
255 0 0 27.1726086643
4
255 0 25...

result:

ok ok (10000 test cases)

Test #11:

score: 0
Accepted
time: 35ms
memory: 3736kb

input:

10000
208 135 142
248 171 248
162 65 32
9 162 63
91 20 90
188 236 117
62 200 71
14 228 53
68 196 133
27 159 255
129 86 121
46 216 3
213 65 177
7 28 45
215 136 153
108 54 113
254 122 99
243 222 89
18 255 48
14 157 204
210 33 132
87 4 33
231 222 233
30 14 100
10 45 226
49 210 232
113 79 18
235 109 14
...

output:

4
255 0 255 1000.0000000000
0 0 255 99.8750000000
255 255 255 42.4292166208
255 255 0 152.6000338574
4
255 255 255 1000.0000000000
0 255 255 10.8841463415
255 0 255 86.4496086475
255 255 0 7.3932757384
4
255 0 0 1000.0000000000
0 0 0 150.0949367089
255 255 0 86.2472437181
255 0 255 35.9039878311
4
0...

result:

ok ok (10000 test cases)

Test #12:

score: 0
Accepted
time: 33ms
memory: 3760kb

input:

10000
119 133 74
50 106 117
59 203 94
72 223 194
202 156 197
61 81 108
77 80 107
240 230 250
53 54 66
133 197 44
33 113 2
83 54 163
206 241 33
41 83 202
182 57 124
37 155 241
186 245 218
153 80 29
47 83 212
41 32 94
107 89 186
58 161 214
114 106 34
17 89 16
19 117 170
169 115 74
55 143 33
6 182 196
...

output:

4
255 0 0 1000.0000000000
0 0 0 129.5901639344
255 255 0 93.2394035907
0 255 255 101.6408910353
4
0 255 0 1000.0000000000
255 255 0 120.2830188679
0 0 0 65.3785596083
0 0 255 153.5010144484
4
0 255 0 1000.0000000000
255 255 0 138.0275229358
0 0 0 93.6515631173
0 255 255 104.6152695162
4
0 255 255 10...

result:

ok ok (10000 test cases)

Test #13:

score: 0
Accepted
time: 33ms
memory: 3680kb

input:

10000
170 100 234
20 253 12
243 196 46
206 129 235
149 5 166
232 179 7
149 75 45
98 197 156
206 22 133
230 176 54
159 228 135
170 92 118
90 61 180
9 26 18
21 65 122
40 143 87
125 192 199
176 35 144
44 85 243
153 238 203
227 9 212
200 74 226
253 135 20
139 117 222
230 43 212
42 201 224
22 222 152
191...

output:

4
255 0 255 1000.0000000000
0 0 255 161.7537313433
255 255 255 129.0494063852
255 0 0 24.0775545369
4
0 255 0 1000.0000000000
255 255 0 21.1618257261
0 0 0 2.1059800610
0 255 255 12.0409806772
4
255 255 0 1000.0000000000
0 255 0 20.4000000000
255 0 0 72.2156326082
255 255 255 47.8706869052
4
255 0 2...

result:

ok ok (10000 test cases)

Test #14:

score: 0
Accepted
time: 38ms
memory: 3756kb

input:

10000
67 216 241
14 40 250
28 215 219
200 241 181
3 167 13
227 218 113
85 72 151
116 20 162
202 252 17
54 184 231
49 90 219
117 173 19
37 53 223
10 195 119
118 128 187
46 208 215
54 85 104
71 99 34
234 95 0
44 223 10
14 248 47
123 70 75
245 118 231
131 187 137
34 62 21
4 118 233
40 183 96
242 97 190...

output:

4
0 255 255 1000.0000000000
255 255 255 84.5792079208
0 0 255 43.4762341523
0 255 0 14.7065064255
4
0 0 255 1000.0000000000
255 0 255 17.0000000000
0 255 255 40.8905661492
0 0 0 5.0713311862
4
0 255 255 1000.0000000000
255 255 255 39.8882681564
0 0 255 47.1417166670
0 255 0 36.8838764439
4
255 255 2...

result:

ok ok (10000 test cases)

Test #15:

score: 0
Accepted
time: 36ms
memory: 3656kb

input:

10000
252 245 224
4 171 9
240 190 208
69 15 254
4 230 90
0 255 17
6 26 58
150 187 237
239 242 146
255 227 231
232 117 26
44 255 111
183 1 9
121 85 207
15 245 120
247 181 40
1 255 164
244 139 255
131 248 27
161 24 241
63 44 16
207 36 251
15 227 163
49 7 180
27 7 23
61 254 235
14 8 11
200 7 3
26 254 3...

output:

4
255 255 255 1000.0000000000
0 255 255 3.5747663551
255 0 255 11.3850471224
255 255 0 31.0336532097
4
0 255 0 1000.0000000000
255 255 0 6.2962962963
0 0 0 87.0997093397
0 255 255 9.5113508068
4
255 255 255 1000.0000000000
0 255 255 26.7482517483
255 0 255 80.1247007670
255 255 0 49.3579866389
4
0 0...

result:

ok ok (10000 test cases)

Test #16:

score: 0
Accepted
time: 26ms
memory: 3728kb

input:

10000
10 7 240
232 252 180
5 169 10
1 40 6
252 2 242
245 8 5
249 17 249
255 2 233
12 3 1
2 6 253
252 254 2
251 245 6
254 4 252
10 244 245
254 218 52
255 8 4
20 112 248
253 0 254
250 234 1
226 245 216
11 6 2
245 139 0
8 28 233
1 11 24
246 250 253
9 124 17
255 26 1
14 251 46
2 14 248
233 1 44
12 255 1...

output:

4
0 0 255 1000.0000000000
255 0 255 10.9442060086
0 255 255 7.4443467629
0 0 0 15.0193885112
4
255 255 255 1000.0000000000
0 255 255 33.1355932203
255 0 255 4.2857310908
255 255 0 75.6201215139
4
0 255 0 1000.0000000000
255 255 0 8.0188679245
0 0 0 89.5544507917
0 255 255 10.6001500936
4
0 0 0 1000....

result:

ok ok (10000 test cases)

Test #17:

score: 0
Accepted
time: 22ms
memory: 3748kb

input:

10000
0 3 254
9 1 2
250 254 0
4 1 65
212 3 253
253 255 254
252 1 255
255 230 11
253 215 255
113 12 16
252 253 0
255 254 254
254 255 252
0 32 254
255 36 252
10 1 243
3 46 11
99 3 255
250 0 248
11 5 3
253 254 255
23 2 1
0 253 4
255 255 248
255 237 250
7 13 1
251 251 246
0 0 4
0 2 1
254 254 0
189 3 0
2...

output:

4
0 0 255 1000.0000000000
255 0 255 0.0000000000
0 255 255 3.0118110236
0 0 0 1.0000697477
4
0 0 0 1000.0000000000
255 0 0 9.1071428571
0 255 0 1.0085477301
0 0 255 2.0012806598
4
255 255 0 1000.0000000000
0 255 0 5.0196850394
255 0 0 1.0001937316
255 255 255 0.0000000000
4
0 0 0 1000.0000000000
255...

result:

ok ok (10000 test cases)

Test #18:

score: 0
Accepted
time: 22ms
memory: 3700kb

input:

10000
0 253 255
255 252 2
255 0 255
250 253 255
253 0 255
252 251 236
8 255 0
247 254 254
2 255 255
255 255 252
0 0 4
6 250 0
7 32 0
0 2 255
255 9 255
3 255 1
255 255 242
254 0 0
0 0 254
0 255 255
1 0 9
255 255 2
0 255 0
0 0 255
254 9 1
253 255 254
252 0 255
0 0 255
254 0 252
255 247 0
2 250 255
255...

output:

4
0 255 255 1000.0000000000
255 255 255 0.0000000000
0 0 255 2.0000000000
0 255 0 0.0000000000
4
255 255 0 1000.0000000000
0 255 0 0.0000000000
255 0 0 3.0237154150
255 255 255 2.0001406003
4
255 0 255 1000.0000000000
0 0 255 0.0000000000
255 255 255 0.0000000000
255 0 0 0.0000000000
4
255 255 255 1...

result:

ok ok (10000 test cases)

Test #19:

score: 0
Accepted
time: 18ms
memory: 3720kb

input:

10000
0 0 0
255 0 255
0 255 255
255 255 1
0 0 0
0 255 1
255 0 254
0 255 0
0 203 255
0 2 0
255 0 255
255 254 0
255 0 255
255 255 228
0 255 255
0 255 255
0 254 0
253 0 0
242 0 0
255 0 0
255 252 0
0 0 0
0 0 0
255 255 255
0 0 255
255 255 0
4 255 0
0 1 0
0 0 255
0 253 253
0 255 255
0 0 255
255 0 0
1 255 ...

output:

4
0 0 0 1000.0000000000
255 0 0 0.0000000000
0 255 0 0.0000000000
0 0 255 0.0000000000
4
255 0 255 1000.0000000000
0 0 255 0.0000000000
255 255 255 0.0000000000
255 0 0 0.0000000000
4
0 255 255 1000.0000000000
255 255 255 0.0000000000
0 0 255 0.0000000000
0 255 0 0.0000000000
4
255 255 0 1000.000000...

result:

ok ok (10000 test cases)

Test #20:

score: 0
Accepted
time: 18ms
memory: 3656kb

input:

10000
0 0 0
0 255 255
255 0 255
255 255 0
255 255 255
255 0 0
255 255 255
0 0 255
0 0 0
0 0 255
255 255 0
0 0 255
255 0 0
0 0 0
255 255 0
0 0 255
0 0 0
255 255 0
0 0 255
0 255 0
255 0 255
0 255 255
0 255 0
0 255 0
1 0 255
255 0 254
255 0 255
255 255 255
0 255 255
255 0 255
255 0 255
0 255 255
255 25...

output:

4
0 0 0 1000.0000000000
255 0 0 0.0000000000
0 255 0 0.0000000000
0 0 255 0.0000000000
4
0 255 255 1000.0000000000
255 255 255 0.0000000000
0 0 255 0.0000000000
0 255 0 0.0000000000
4
255 0 255 1000.0000000000
0 0 255 0.0000000000
255 255 255 0.0000000000
255 0 0 0.0000000000
4
255 255 0 1000.000000...

result:

ok ok (10000 test cases)