QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#69342 | #2350. Integer Cow | chenshi | Compile Error | / | / | C++20 | 1.1kb | 2022-12-26 17:12:36 | 2022-12-26 17:12:38 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2022-12-26 17:12:38]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2022-12-26 17:12:36]
- 提交
answer
#include<cstdio>
#include<cmath>
using namespace std;
const int E=1e5;const long long inf=8e18;
int T,xc,yc,r,x0,y0,ax,ay,X,Y;long long ans;
inline bool chk(int x,int y){return (xc-x)*1ll*(xc-x)+(yc-y)*1ll*(yc-y)<=r*1ll*r;}
inline void upd(int x,int y){
long long t;
for(int i=x-1;i<=x+1;++i) for(int j=y-1;j<=y+1;++j)
if(chk(i,j)&&(t=(i-x0)*1ll*(i-x0)+(j-y0)*1ll*(j-y0))<ans) ans=t,ax=i,ay=j;
}
int main(){
for(scanf("%d",&T);T--;){
scanf("%d%d%d%d%d",&xc,&yc,&r,&x0,&y0);ans=inf;
if(chk(x0,y0)){printf("0\n%d %d\n",x0,y0);continue;}
if(x0==xc) X=x0;else X=xc-(xc-x0)*(long double)r/sqrtl((xc-x0)*1ll*(xc-x0)+(yc-y0)*1ll*(yc-y0));
if(y0==yc) Y=y0;else Y=yc-(yc-y0)*(long double)r/sqrtl((xc-x0)*1ll*(xc-x0)+(yc-y0)*1ll*(yc-y0));
for(int i=X-E,L,R,t;i<=X+E;++i) if(abs(i-xc)<=r){
t=sqrtl(r*1ll*r-(i-xc)*1ll*(i-xc));L=yc-t;R=yc+t;
upd(i,L);upd(i,R);
if(L<=yc&&yc<=r) upd(i,yc);
}
for(int i=Y-E,L,R,t;i<=Y+E;++i) if(abs(i-yc)<=r){
t=sqrtl(r*1ll*r-(i-yc)*1ll*(i-yc));L=xc-t;R=xc+t;
upd(L,i);upd(R,i);
if(L<=xc&&xc<=r) upd(xc,i);
}
printf("1\n%d %d %d %d\n",x0,y0,ax,ay);
}
return 0;
}
Details
answer.code:5:18: error: ‘int y0’ redeclared as different kind of entity 5 | int T,xc,yc,r,x0,y0,ax,ay,X,Y;long long ans; | ^~ In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/c++/11/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/c++config.h:571, from /usr/include/c++/11/cstdio:41, from answer.code:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:220:1: note: previous declaration ‘double y0(double)’ 220 | __MATHCALL (y0,, (_Mdouble_)); | ^~~~~~~~~~ answer.code: In function ‘void upd(int, int)’: answer.code:10:53: error: invalid operands of types ‘int’ and ‘double(double) noexcept’ to binary ‘operator-’ 10 | if(chk(i,j)&&(t=(i-x0)*1ll*(i-x0)+(j-y0)*1ll*(j-y0))<ans) ans=t,ax=i,ay=j; | ~^~~ | | | | | double(double) noexcept | int answer.code:10:64: error: invalid operands of types ‘int’ and ‘double(double) noexcept’ to binary ‘operator-’ 10 | if(chk(i,j)&&(t=(i-x0)*1ll*(i-x0)+(j-y0)*1ll*(j-y0))<ans) ans=t,ax=i,ay=j; | ~^~~ | | | | | double(double) noexcept | int answer.code: In function ‘int main()’: answer.code:14:33: warning: format ‘%d’ expects argument of type ‘int*’, but argument 6 has type ‘double (*)(double) noexcept’ [-Wformat=] 14 | scanf("%d%d%d%d%d",&xc,&yc,&r,&x0,&y0);ans=inf; | ~^ ~~~ | | | | int* double (*)(double) noexcept answer.code:15:27: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘int’ [-fpermissive] 15 | if(chk(x0,y0)){printf("0\n%d %d\n",x0,y0);continue;} | ^~ | | | double (*)(double) noexcept answer.code:6:27: note: initializing argument 2 of ‘bool chk(int, int)’ 6 | inline bool chk(int x,int y){return (xc-x)*1ll*(xc-x)+(yc-y)*1ll*(yc-y)<=r*1ll*r;} | ~~~~^ answer.code:15:47: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘double (*)(double) noexcept’ [-Wformat=] 15 | if(chk(x0,y0)){printf("0\n%d %d\n",x0,y0);continue;} | ~^ ~~ | | | | int double (*)(double) noexcept answer.code:16:95: error: invalid operands of types ‘int’ and ‘double(double) noexcept’ to binary ‘operator-’ 16 | if(x0==xc) X=x0;else X=xc-(xc-x0)*(long double)r/sqrtl((xc-x0)*1ll*(xc-x0)+(yc-y0)*1ll*(yc-y0)); | ~~^~~ | | | | | double(double) noexcept | int answer.code:16:107: error: invalid operands of types ‘int’ and ‘double(double) noexcept’ to binary ‘operator-’ 16 | if(x0==xc) X=x0;else X=xc-(xc-x0)*(long double)r/sqrtl((xc-x0)*1ll*(xc-x0)+(yc-y0)*1ll*(yc-y0)); | ~~^~~ | | | | | double(double) noexcept | int answer.code:17:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 17 | if(y0==yc) Y=y0;else Y=yc-(yc-y0)*(long double)r/sqrtl((xc-x0)*1ll*(xc-x0)+(yc-y0)*1ll*(yc-y0)); | ~~^~~~ answer.code:17:30: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘int’ [-fpermissive] 17 | if(y0==yc) Y=y0;else Y=yc-(yc-y0)*(long double)r/sqrtl((xc-x0)*1ll*(xc-x0)+(yc-y0)*1ll*(yc-y0)); | ^~ ...