dev c++编译正确,样例过了,洛谷编译失败,蒟蒻求调
  • 板块P1378 油滴扩展
  • 楼主isop
  • 当前回复5
  • 已保存回复5
  • 发布时间2024/7/26 09:11
  • 上次更新2024/7/26 10:20:16
查看原帖
dev c++编译正确,样例过了,洛谷编译失败,蒟蒻求调
1071516
isop楼主2024/7/26 09:11

失败信息

/tmp/compiler_q6bbbexw/src:6:13: 错误:‘double y1’ redeclared as different kind of entity
    6 | double x1=0,y1=0,x2=0,y2=0;
      |             ^~
In file included from /nix/store/x8lqlydsxbrwvf6p7v18gws8kn1xl37f-glibc-2.38-23-dev/include/features.h:503,
                 from /nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/x86_64-unknown-linux-gnu/bits/os_defines.h:39,
                 from /nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/x86_64-unknown-linux-gnu/bits/c++config.h:679,
                 from /nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/cassert:43,
                 from /nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/x86_64-unknown-linux-gnu/bits/stdc++.h:33,
                 from /tmp/compiler_q6bbbexw/src:1:
/nix/store/x8lqlydsxbrwvf6p7v18gws8kn1xl37f-glibc-2.38-23-dev/include/bits/mathcalls.h:224:1: 附注:previous declaration ‘double y1(double)’
  224 | __MATHCALL (y1,, (_Mdouble_));
      | ^~~~~~~~~~
/tmp/compiler_q6bbbexw/src: In function ‘double area(int)’:
/tmp/compiler_q6bbbexw/src:15:27: 错误:操作数类型‘double’和‘double(double) noexcept’ {aka ‘double(double)’}对双目‘operator-’而言无效
   15 |         d2=min(abs(a[k][1]-y1),abs(a[k][1]-y2));
      |                    ~~~~~~~^~~
      |                          | |
      |                          | double(double) noexcept {aka double(double)}
      |                          double
/tmp/compiler_q6bbbexw/src: In function ‘int main()’:
/tmp/compiler_q6bbbexw/src:60:16: 错误:no match for ‘operator>>’ (operand types are ‘std::basic_istream<char>::__istream_type’ {aka ‘std::basic_istream<char>’} and ‘double(double) noexcept’ {aka ‘double(double)’})
   60 |         cin>>x1>>y1>>x2>>y2;
      |         ~~~~~~~^~~~
      |            |     |
      |            |     double(double) noexcept {aka double(double)}
      |            std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/sstream:40,
                 from /nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/complex:45,
                 from /nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/ccomplex:39,
                 from /nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/x86_64-unknown-linux-gnu/bits/stdc++.h:127:
/nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/istream:325:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  325 |       operator>>(void*& __p)
      |       ^~~~~~~~
/nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/istream:325:7: 附注:  conversion of argument 1 would be ill-formed:
/tmp/compiler_q6bbbexw/src:60:18: 错误:invalid conversion from ‘double (*)(double) noexcept’ {aka ‘double (*)(double)’} to ‘void*’ [-fpermissive]
   60 |         cin>>x1>>y1>>x2>>y2;
      |                  ^~
      |                  |
      |                  double (*)(double) noexcept {aka double (*)(double)}
/tmp/compiler_q6bbbexw/src:60:18: 错误:无法将右值‘(void*)y1’绑定到‘void*&’
/nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/istream:201:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  201 |       operator>>(unsigned long long& __n)
      |       ^~~~~~~~
/nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/istream:201:7: 附注:  conversion of argument 1 would be ill-formed:
/tmp/compiler_q6bbbexw/src:60:18: 错误:invalid conversion from ‘double (*)(double) noexcept’ {aka ‘double (*)(double)’} to ‘long long unsigned int’ [-fpermissive]
   60 |         cin>>x1>>y1>>x2>>y2;
      |                  ^~
      |                  |
      |                  double (*)(double) noexcept {aka double (*)(double)}
/tmp/compiler_q6bbbexw/src:60:18: 错误:无法将右值‘(long long unsigned int)y1’绑定到‘long long unsigned int&’
/nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/istream:197:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  197 |       operator>>(long long& __n)
      |       ^~~~~~~~
/nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/istream:197:7: 附注:  conversion of argument 1 would be ill-formed:
/tmp/compiler_q6bbbexw/src:60:18: 错误:invalid conversion from ‘double (*)(double) noexcept’ {aka ‘double (*)(double)’} to ‘long long int’ [-fpermissive]
   60 |         cin>>x1>>y1>>x2>>y2;
      |                  ^~
      |                  |
      |                  double (*)(double) noexcept {aka double (*)(double)}
/tmp/compiler_q6bbbexw/src:60:18: 错误:无法将右值‘(long long int)y1’绑定到‘long long int&’
/nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/istream:192:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  192 |       operator>>(unsigned long& __n)
      |       ^~~~~~~~
/nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/istream:192:7: 附注:  conversion of argument 1 would be ill-formed:
/tmp/compiler_q6bbbexw/src:60:18: 错误:invalid conversion from ‘double (*)(double) noexcept’ {aka ‘double (*)(double)’} to ‘long unsigned int’ [-fpermissive]
   60 |         cin>>x1>>y1>>x2>>y2;
      |                  ^~
      |                  |
      |                  double (*)(double) noexcept {aka double (*)(double)}
/tmp/compiler_q6bbbexw/src:60:18: 错误:无法将右值‘(long unsigned int)y1’绑定到‘long unsigned int&’
/nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/istream:188:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  188 |       operator>>(long& __n)
      |       ^~~~~~~~
/nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/istream:188:7: 附注:  conversion of argument 1 would be ill-formed:
/tmp/compiler_q6bbbexw/src:60:18: 错误:invalid conversion from ‘double (*)(double) noexcept’ {aka ‘double (*)(double)’} to ‘long int’ [-fpermissive]
   60 |         cin>>x1>>y1>>x2>>y2;
      |                  ^~
      |                  |
      |                  double (*)(double) noexcept {aka double (*)(double)}
/tmp/compiler_q6bbbexw/src:60:18: 错误:无法将右值‘(long int)y1’绑定到‘long int&’
/nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/istream:184:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  184 |       operator>>(unsigned int& __n)
      |       ^~~~~~~~
/nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/istream:184:7: 附注:  conversion of argument 1 would be ill-formed:
/tmp/compiler_q6bbbexw/src:60:18: 错误:invalid conversion from ‘double (*)(double) noexcept’ {aka ‘double (*)(double)’} to ‘unsigned int’ [-fpermissive]
   60 |         cin>>x1>>y1>>x2>>y2;
      |                  ^~
      |                  |
      |                  double (*)(double) noexcept {aka double (*)(double)}
/tmp/compiler_q6bbbexw/src:60:18: 错误:无法将右值‘(unsigned int)y1’绑定到‘unsigned int&’
/nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/istream:181:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]’ (near match)
  181 |       operator>>(int& __n);
      |       ^~~~~~~~
/nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/istream:181:7: 附注:  conversion of argument 1 would be ill-formed:
/tmp/compiler_q6bbbexw/src:60:18: 错误:invalid conversion from ‘double (*)(double) noexcept’ {aka ‘double (*)(double)’} to ‘int’ [-fpermissive]
   60 |         cin>>x1>>y1>>x2>>y2;
      |                  ^~
      |                  |
      |                  double (*)(double) noexcept {aka double (*)(double)}
/tmp/compiler_q6bbbexw/src:60:18: 错误:无法将右值‘(int)y1’绑定到‘int&’
/nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/istream:177:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  177 |       operator>>(unsigned short& __n)
      |       ^~~~~~~~
/nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/istream:177:7: 附注:  conversion of argument 1 would be ill-formed:
/tmp/compiler_q6bbbexw/src:60:18: 错误:invalid conversion from ‘double (*)(double) noexcept’ {aka ‘double (*)(double)’} to ‘short unsigned int’ [-fpermissive]
   60 |         cin>>x1>>y1>>x2>>y2;
      |                  ^~
      |                  |
      |                  double (*)(double) noexcept {aka double (*)(double)}
/tmp/compiler_q6bbbexw/src:60:18: 错误:无法将右值‘(short unsigned int)y1’绑定到‘short unsigned int&’
/nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/istream:174:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short in
...

源码

#include<bits/stdc++.h>
#define PI 3.1415927
using namespace std;

int n;
double x1=0,y1=0,x2=0,y2=0;
double a[10][3]={0};
double ans=114514;
bool vis[10]={0};

inline double area(int k)
{
	double d1,d2;
	d1=min(abs(a[k][0]-x1),abs(a[k][0]-x2));
	d2=min(abs(a[k][1]-y1),abs(a[k][1]-y2));
	double r1=min(d1,d2);
	double r2=114514;
	for(int i=1;i<=n;i++)
	{
		double dis=0;
		if(vis[i])
		{
			dis=sqrt((a[i][0]-a[k][0])*(a[i][0]-a[k][0])+(a[k][1]-a[i][1])*(a[k][1]-a[i][1]));
			if(dis<=a[i][2])
			{
				a[k][2]=0;
				return 0;
			}
			r2=min(r2,(dis-a[i][2]));
		}
	}
	double r=min(r1,r2);
	a[k][2]=r;
	return PI*r*r;
}

void dfs(int num,double s)
{
	if(num==n)
	{
		ans=min(ans,s);
	}
	for(int i=1;i<=n;i++)
	{
		if(!vis[i])
		{
			s+=area(i);
			vis[i]=1;
			dfs(num+1,s);
			s-=area(i);
			a[i][2]=0;
			vis[i]=0;
		}
	}
}

int main()
{
	cin>>n;
	cin>>x1>>y1>>x2>>y2;
	for(int i=1;i<=n;i++) cin>>a[i][0]>>a[i][1];
	dfs(0,0);
	printf("%.0f",ans);
} 
2024/7/26 09:11
加载中...