Submission #742930

# Submission time Handle Problem Language Result Execution time Memory
742930 2023-05-17T06:16:19 Z jamezzz Nicelines (RMI20_nicelines) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#include "nice_lines.h"

#define maxn 10000

#define dist(a,b,x,y) (long double)abs(y-a*x-b)/pow(1+a*a,0.5);

void solve(int subtask_id,int N){
	int x[]={0,0,100,100},y[]={0,100,0,100};
	long double ans[]={query(0,0),query(0,100),query(100,0),query(100,100)};
    for(int a=-maxn;a<=maxn;++a){
		int bb=(int)pow(1+a*a,0.5)*ans[0];
		vector<int> v;
		v.push_back(bb);
		v.push_back(bb+1);
		v.push_back(bb-1);
		v.push_back(-bb);
		v.push_back(-bb+1);
		v.push_back(-bb-1);
		for(int b:v){
			bool can=true;
			//printf("%d %d: ",a,b);
			for(int i=0;i<4;++i){
				//printf("(%Lf %Lf) ",dist(a,b,x[i],y[i]),ans[i]);
				if(abs(dist(a,b,x[i],y[i])-ans[i])>1e-6)can=false;
			}
			//printf("\n");
			if(can)the_lines_are({a},{b});
		}
	}
}

Compilation message

nicelines.cpp: In function 'void solve(int, int)':
nicelines.cpp:7:63: error: expected ')' before ';' token
    7 | #define dist(a,b,x,y) (long double)abs(y-a*x-b)/pow(1+a*a,0.5);
      |                                                               ^
nicelines.cpp:26:12: note: in expansion of macro 'dist'
   26 |     if(abs(dist(a,b,x[i],y[i])-ans[i])>1e-6)can=false;
      |            ^~~~
nicelines.cpp:26:11: note: to match this '('
   26 |     if(abs(dist(a,b,x[i],y[i])-ans[i])>1e-6)can=false;
      |           ^
nicelines.cpp:7:63: error: expected ')' before ';' token
    7 | #define dist(a,b,x,y) (long double)abs(y-a*x-b)/pow(1+a*a,0.5);
      |                                                               ^
nicelines.cpp:26:12: note: in expansion of macro 'dist'
   26 |     if(abs(dist(a,b,x[i],y[i])-ans[i])>1e-6)can=false;
      |            ^~~~
nicelines.cpp:26:7: note: to match this '('
   26 |     if(abs(dist(a,b,x[i],y[i])-ans[i])>1e-6)can=false;
      |       ^
nicelines.cpp:26:38: error: expected ';' before ')' token
   26 |     if(abs(dist(a,b,x[i],y[i])-ans[i])>1e-6)can=false;
      |                                      ^
      |                                      ;
nicelines.cpp:26:31: warning: statement has no effect [-Wunused-value]
   26 |     if(abs(dist(a,b,x[i],y[i])-ans[i])>1e-6)can=false;
      |                               ^~~~~~~