QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#137463 | #2350. Integer Cow | whsyhyyh# | WA | 533ms | 3648kb | C++14 | 1.5kb | 2023-08-10 12:58:21 | 2023-08-10 12:58:22 |
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 -1
#define LL long long
#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;
LL ans;
int ansx,ansy;
double dist(int x,int y,int xx,int yy) {
return sqrt(1LL*(x-xx)*(x-xx)+1LL*(y-yy)*(y-yy));
}
void work(int i,int j) {
LL tmpx=(int) ceil(x)+i;
LL tmpy=(int) ceil(y)+j;
if(1LL*(tmpx-Xc)*(tmpx-Xc)+1LL*(tmpy-Yc)*(tmpy-Yc)<=1LL*R*R) {
if(ans<0||1LL*(tmpx-X0)*(tmpx-X0)+1LL*(tmpy-Yc)*(tmpy-Yc)<ans)
ans=1LL*(tmpx-X0)*(tmpx-X0)+1LL*(tmpy-Yc)*(tmpy-Yc),ansx=tmpx,ansy=tmpy;
}
}
int main() {
T=rd();
int sz=sqrt(350000000/T);
while(T--) {
Xc=rd(),Yc=rd(),R=rd(),X0=rd(),Y0=rd();
if(1LL*(X0-Xc)*(X0-Xc)+1LL*(Y0-Yc)*(Y0-Yc)<=1LL*R*R) {
printf("0\n%d %d\n",X0,Y0);
continue;
}
double tmpx=1LL*R*abs(X0-Xc)/dist(X0,Y0,Xc,Yc);
double tmpy=sqrt(1LL*R*R-1LL*tmpx*tmpx);
ans=inf;
if(X0<Xc) x=Xc-tmpx;else x=Xc+tmpx;
if(Y0<Yc) y=Yc-tmpy;else y=Yc+tmpy;
rep(i,-sz,sz) rep(j,-sz,sz) work(i,j);
printf("1\n%d %d %d %d\n",X0,Y0,ansx,ansy);
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 482ms
memory: 3576kb
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: 3644kb
input:
1 0 0 1 0 0
output:
0 0 0
result:
ok correct (1 test case)
Test #3:
score: -100
Wrong Answer
time: 533ms
memory: 3648kb
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 -3 0 1 -2 0 -2 -2 1 0 1 1 -1 1 -1 0 -1 -3 1 -1 -1 -1 2 1 0 -3 0 -2 0 -3 -2 0 2 1 1 -2 -2 -2 0 1 -1 -2 0 -2 1 -2 2 -1 2 0 -1 2 1 -3 -2 -3 1 0 -1 1 1 1 -3 1 2 1 -2 -1 1 0 1 -2 0 -2 2 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 -2 -2 0 -2 -2 0 -2 -2 0 1 -1 1 ...
result:
wrong answer the distance of your solution has travelled is longer than expected. (test case 1)