QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#106942 | #6412. Classical Geometry Problem | bulijiojiodibuliduo# | WA | 2ms | 3660kb | C++ | 1.5kb | 2023-05-19 20:53:52 | 2023-05-19 20:53:55 |
Judging History
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
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;
ans.pb(mp(array<int,3>{fx,fy,fz},1000.));
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>{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));
for (auto [p,t]:ans) {
printf("%d %d %d %.10f\n",255*p[0],255*p[1],255*p[2],t);
}
}
int _;
int main() {
for (scanf("%d",&_);_;_--) {
solve();
}
}
详细
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3660kb
input:
3 105 255 175 174 174 174 0 0 0
output:
4 0 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:
wrong answer too far from the target: (0.000000, 255.000000, 161.704770) instead of (105, 255, 175) (test case 1)