QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#51057#2040. Physical DistancingregstdCompile Error//C++936b2022-09-30 13:17:072022-09-30 13:17:08

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-30 13:17:08]
  • Judged
  • [2022-09-30 13:17:07]
  • Submitted

answer

https://qoj.ac/problem/2040#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define L(i,l,r) for(int i=l;i<=r;i++)
#define R(i,r,l) for(int i=r;i>=l;i--)
const int N=5e5+5,inf=2e9,mod=1e9+7;
int rd() {int x; scanf("%d",&x); return x;}
int x[105],y[106];
int w,h,n;
int check(double now) {
	int hi=0;
	int vis[105];
	
	queue<int>q;
	L(i,1,n) {
		if(y[i]<now) q.push(i);
		else vis[i]=0;
	}
	while(!q.empty()) {
		int i=q.front(); q.pop();
		
		hi=max(hi,y[i]);
		L(j,1,n) {
			if((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])<4*now*now)
				if(!vis[j]) {
					vis[j]=1;
					q.push(j);
				}
		}
	}
	return h-hi>=now;
}
int main() {
  
  cin>>w>>h>>n;
  double l=-100,r=100;
  L(i,1,n) {
  	scanf("%d%d",&x[i],&y[i]);
  	
  }
  double eps=1e-8;
  while(r-l>=eps) {
  	double mid=(l+r)/2;
  	if(check(mid)) l=mid;
		else r=mid;
  }
  printf("%.10lf",l);
  return 0;
}

Details

answer.code:1:1: error: ‘https’ does not name a type
    1 | https://qoj.ac/problem/2040#include <bits/stdc++.h>
      | ^~~~~
answer.code: In function ‘int rd()’:
answer.code:7:18: error: ‘scanf’ was not declared in this scope
    7 | int rd() {int x; scanf("%d",&x); return x;}
      |                  ^~~~~
answer.code: In function ‘int check(double)’:
answer.code:14:9: error: ‘queue’ was not declared in this scope
   14 |         queue<int>q;
      |         ^~~~~
answer.code:14:15: error: expected primary-expression before ‘int’
   14 |         queue<int>q;
      |               ^~~
answer.code:16:30: error: ‘q’ was not declared in this scope
   16 |                 if(y[i]<now) q.push(i);
      |                              ^
answer.code:19:16: error: ‘q’ was not declared in this scope
   19 |         while(!q.empty()) {
      |                ^
answer.code:22:20: error: ‘max’ was not declared in this scope
   22 |                 hi=max(hi,y[i]);
      |                    ^~~
answer.code: In function ‘int main()’:
answer.code:35:3: error: ‘cin’ was not declared in this scope
   35 |   cin>>w>>h>>n;
      |   ^~~
answer.code:38:9: error: ‘scanf’ was not declared in this scope
   38 |         scanf("%d%d",&x[i],&y[i]);
      |         ^~~~~
answer.code:47:3: error: ‘printf’ was not declared in this scope
   47 |   printf("%.10lf",l);
      |   ^~~~~~
answer.code:1:1: note: ‘printf’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?
  +++ |+#include <cstdio>
    1 | https://qoj.ac/problem/2040#include <bits/stdc++.h>