QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#137462#2350. Integer Cowwhsyhyyh#Compile Error//C++141.5kb2023-08-10 12:57:492023-08-10 12:57:52

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-10 12:57:52]
  • 评测
  • [2023-08-10 12:57:49]
  • 提交

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 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;
}

Details

answer.code:19:1: error: ‘LL’ does not name a type
   19 | LL ans;
      | ^~
answer.code: In function ‘void work(int, int)’:
answer.code:25:9: error: ‘LL’ was not declared in this scope
   25 |         LL tmpx=(int) ceil(x)+i;
      |         ^~
answer.code:26:11: error: expected ‘;’ before ‘tmpy’
   26 |         LL tmpy=(int) ceil(y)+j;
      |           ^~~~~
      |           ;
answer.code:27:17: error: ‘tmpx’ was not declared in this scope; did you mean ‘tm’?
   27 |         if(1LL*(tmpx-Xc)*(tmpx-Xc)+1LL*(tmpy-Yc)*(tmpy-Yc)<=1LL*R*R) {
      |                 ^~~~
      |                 tm
answer.code:27:41: error: ‘tmpy’ was not declared in this scope; did you mean ‘tm’?
   27 |         if(1LL*(tmpx-Xc)*(tmpx-Xc)+1LL*(tmpy-Yc)*(tmpy-Yc)<=1LL*R*R) {
      |                                         ^~~~
      |                                         tm
answer.code:28:20: error: ‘ans’ was not declared in this scope; did you mean ‘ansy’?
   28 |                 if(ans<0||1LL*(tmpx-X0)*(tmpx-X0)+1LL*(tmpy-Yc)*(tmpy-Yc)<ans)
      |                    ^~~
      |                    ansy
answer.code: In function ‘int main()’:
answer.code:43:17: error: ‘ans’ was not declared in this scope; did you mean ‘ansy’?
   43 |                 ans=inf;
      |                 ^~~
      |                 ansy