QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#644909 | #6412. Classical Geometry Problem | taiyangfeng | WA | 0ms | 3956kb | C++20 | 4.1kb | 2024-10-16 15:58:32 | 2024-10-16 15:58:34 |
Judging History
answer
#include<bits/stdc++.h>
#ifdef LOCAL
#define debug(...) printf(__VA_ARGS__)
#define edebug(...) fprintf(stderr, __VA_ARGS__)
#else
#define debug(...)
#define edebug(...)
#endif
#define int ll
#define rep(i, x, y) for(int i = x; i <= y; ++i)
#define nrep(i, x, y) for(int i = x; i >= y; --i)
#define ll long long
#define pii std::pair<int,int>
#define pb emplace_back
#define fi first
#define se second
template <class T>
inline void ckmax(T &a, T b) {
if(a < b) a = b;
}
template <class T>
inline void ckmin(T &a, T b) {
if(a > b) a = b;
}
auto rt_YES = []{puts("YES");};
auto rt_Yes = []{puts("Yes");};
auto rt_NO = []{puts("NO");};
auto rt_No = []{puts("No");};
namespace IO {
#define isdigit(x) (x >= '0' && x <= '9')
inline char gc() {
return getchar();
}
inline bool blank(char ch) {
return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
}
template <class T>
inline void read(T &x) {
double tmp = 1;
bool sign = 0;
x = 0;
char ch = gc();
for(; !isdigit(ch); ch = gc())
if(ch == '-') sign = 1;
for(; isdigit(ch); ch = gc())
x = x * 10 + (ch - '0');
if(ch == '.')
for(ch = gc(); isdigit(ch); ch = gc())
tmp /= 10.0, x += tmp * (ch - '0');
if(sign) x = -x;
}
inline void read(char *s) {
char ch = gc();
for(; blank(ch); ch = gc());
for(; !blank(ch); ch = gc())
*s++ = ch;
*s = 0;
}
inline void read(char &c) {
for(c = gc(); blank(c); c = gc());
}
inline void push(const char &c) {
putchar(c);
}
template <class T>
inline void print(T x) {
if(x < 0) {
x = -x;
push('-');
}
static T sta[35];
T top = 0;
do {
sta[top++] = x % 10;
x /= 10;
} while(x);
while(top)
push(sta[--top] + '0');
}
template <class T>
inline void print(T x, char lastChar) {
print(x);
push(lastChar);
}
}
using namespace IO;
struct node{int x,y,z;double dis;}a[10];
int cnt=0;
void solve(){
int x,y,z;read(x),read(y),read(z);
if(!(x||y||z)){puts("0");return;}
double X,Y,Z;
cnt=0;
if(x>=y&&x>=z){
X=255;
Y=255.0/x*y;
Z=255.0/x*z;
a[++cnt]={255,0,0,255};
if(Y>Z){
double T=(255-Y)/(255-Z)*255;
a[++cnt]={255,255,0,255-T};
a[++cnt]={255,255,255,sqrt(Z*Z+(Y+T-255)*(Y+T-255))};
}
else if(Z>Y){
double T=(255-Z)/(255-Y)*255;
a[++cnt]={255,0,255,255-T};
a[++cnt]={255,255,255,sqrt(Y*Y+(Z+T-255)*(Z+T-255))};
}
else a[++cnt]={255,255,255,sqrt(Y*Y*2)};
a[++cnt]={0,0,0,sqrt((X-x)*(X-x)+(Y-y)*(Y-y)+(Z-z)*(Z-z))};
}else if(y>=x&&y>=z){
X=255.0/y*x;
Y=255.0;
Z=255.0/y*z;
a[++cnt]={0,255,0,255};
if(X>Z){
double T=(255-X)/(255-Z)*255;
a[++cnt]={255,255,0,255-T};
a[++cnt]={255,255,255,sqrt(Z*Z+(X+T-255)*(X+T-255))};
}
else if(Z>X){
double T=(255-Z)/(255-X)*255;
a[++cnt]={0,255,255,255-T};
a[++cnt]={255,255,255,sqrt(Z*Z+(X+T-255)*(X+T-255))};
}
else a[++cnt]={255,255,255,sqrt(X*X*2)};
a[++cnt]={0,0,0,sqrt((X-x)*(X-x)+(Y-y)*(Y-y)+(Z-z)*(Z-z))};
}else{
X=255.0/z*x;
Y=255.0/z*y;
Z=255.0;
a[++cnt]={0,0,255,255};
if(X>Y){
double T=(255-X)/(255-Y)*255;
a[++cnt]={255,0,255,255-T};
a[++cnt]={255,255,255,sqrt(Y*Y+(X+T-255)*(X+T-255))};
}
else if(Y>X){
double T=(255-Y)/(255-X)*255;
a[++cnt]={0,255,255,255-T};
a[++cnt]={255,255,255,sqrt(X*X+(Y+T-255)*(Y+T-255))};
}
else a[++cnt]={255,255,255,sqrt(Y*Y*2)};
a[++cnt]={0,0,0,sqrt((X-x)*(X-x)+(Y-y)*(Y-y)+(Z-z)*(Z-z))};
}
print(cnt,'\n');
rep(i,1,cnt)printf("%lld %lld %lld %.12lf\n",a[i].x,a[i].y,a[i].z,a[i].dis);
}
signed main() {
clock_t c1 = clock();
#ifdef LOCAL
freopen("in.in", "r", stdin);
freopen("out.out", "w", stdout);
#endif
//------------------------------------------------------------------
int t;read(t);while(t--)solve();
//------------------------------------------------------------------
end:
std::cerr << "Time : " << clock() - c1 << " ms" << std::endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3956kb
input:
3 105 255 175 174 174 174 0 0 0
output:
4 0 255 0 255.000000000000 0 255 255 119.000000000000 255 255 255 175.559106855782 0 0 0 0.000000000000 3 255 0 0 255.000000000000 255 255 255 360.624458405139 0 0 0 140.296115413079 0
result:
wrong answer too far from the target: (154.905094, 255.000000, 201.616050) instead of (105, 255, 175) (test case 1)