QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#137406 | #2350. Integer Cow | whsyhyyh# | WA | 1ms | 3820kb | C++14 | 1.4kb | 2023-08-10 12:11:36 | 2023-08-10 12:11:37 |
Judging History
answer
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline")
#pragma GCC option("arch=native","tune=native","no-zero-upper")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define eps 1e-8
#define inf 1000000000000000000.0
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define drep(i,r,l) for(int i=r;i>=l;i--)
using namespace std;
int rd() {
int res=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9') {if(ch=='-') f*=-1;ch=getchar();}
while(ch>='0'&&ch<='9') res=(res<<1)+(res<<3)+(ch^48),ch=getchar();
return res*f;
}
int T,Xc,Yc,R,X0,Y0;
double x,y,ans;int ansx,ansy;
double dist(int x,int y,int xx,int yy) {
return sqrt(1.0*(x-xx)*(x-xx)+1.0*(y-yy)*(y-yy));
}
void work(int i,int j) {
int tmpx=i?(int) ceil(x):(int) floor(x);
int tmpy=j?(int) ceil(y):(int) floor(y);
if(dist(tmpx,tmpy,Xc,Yc)-eps<=R) {
double dis=dist(tmpx,tmpy,X0,Y0);
if(dis<ans) ans=dis,ansx=tmpx,ansy=tmpy;
}
}
int main() {
T=rd();
while(T--) {
Xc=rd(),Yc=rd(),R=rd(),X0=rd(),Y0=rd();
if(dist(X0,Y0,Xc,Yc)-eps<=R) {
printf("0\n%d %d\n",X0,Y0);
continue;
}
double tmpx=1.0*abs(R)*abs(X0-Xc)/dist(X0,Y0,Xc,Yc);
double tmpy=sqrt(1.0*R*R-1.0*tmpx*tmpx);
ans=inf;
rep(A,0,1) rep(B,0,1) {
x=A?Xc+tmpx:Xc-tmpx;
y=B?Yc+tmpy:Yc-tmpy;
rep(i,0,1) rep(j,0,1) work(i,j);
}
printf("1\n%d %d %d %d\n",X0,Y0,ansx,ansy);
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3820kb
input:
3 1 2 1 1 2 3 2 5 -10 3 0 0 1 10 0
output:
0 1 2 1 -10 3 -2 2 1 10 0 1 0
result:
ok correct (3 test cases)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
1 0 0 1 0 0
output:
0 0 0
result:
ok correct (1 test case)
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3664kb
input:
100 -1 0 2 -3 -2 0 -2 2 -2 0 2 -1 1 0 1 -1 -3 1 -1 0 -1 2 2 -1 -1 2 -2 2 0 -3 -2 -3 2 -3 -2 0 1 2 2 1 -1 0 1 -2 -2 2 -2 2 -1 -2 1 2 2 -2 2 -1 2 1 -1 2 -2 1 2 -3 -2 -1 1 1 -1 1 2 2 1 1 -3 2 0 1 -2 -1 -1 2 1 -2 0 2 -2 2 -2 -1 -2 -2 1 1 -2 -1 1 2 2 1 2 -3 1 0 -1 -3 -3 2 2 -1 2 1 1 -1 1 -3 -2 1 -2 -3 0 ...
output:
1 -3 -2 -2 -1 1 -2 0 -1 -1 1 0 1 1 -1 1 -1 0 -1 -2 1 -1 -1 -1 0 1 0 -3 0 -2 0 -3 -2 0 2 1 1 -2 -2 -1 -1 1 -1 -2 0 -2 1 -2 2 -1 2 0 -1 2 1 -3 -2 -2 -1 0 -1 1 1 1 -3 2 1 1 -2 -1 1 0 1 -2 0 -1 1 1 -2 -1 0 -2 1 1 -2 -1 -2 1 2 1 1 1 1 0 -1 1 -3 1 2 -1 -1 -3 1 -1 1 1 1 1 -2 -3 -3 -3 0 -2 -2 0 -2 -2 0 1 -1...
result:
wrong answer the distance of your solution has travelled is longer than expected. (test case 83)