QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#690481#9227. Henry the Plumberucup-team902#Compile Error//C++172.1kb2024-10-30 22:26:332024-10-30 22:26:34

Judging History

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

  • [2024-10-30 22:26:34]
  • 评测
  • [2024-10-30 22:26:33]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define cs const
#define re register
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define fi first
#define se second
#define bg begin
cs int RLEN=1<<22|1;
char ibuf[RLEN],*ib,*ob;
inline char gc(){
    (ib==ob)&&(ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
    return (ib==ob)?EOF:*ib++;
}
inline int read(){
	char ch=gc();
	int res=0;bool f=1;
	while(!isdigit(ch))f^=ch=='-',ch=gc();
	while(isdigit(ch))res=(res+(res<<2)<<1)+(ch^48),ch=gc();
	return f?res:-res;
}
template<typename tp>inline void chemx(tp &a,tp b){(a<b)?(a=b):0;}
template<typename tp>inline void chemn(tp &a,tp b){(a>b)?(a=b):0;}
#define int long long

int x1,y1,z1,p1,q1;
int x2,y2,z2,p2,q2;

struct pt{
    int x,y;
    pt(int _x=0,int _y=0):x(_x),y(_y){}
    friend inline pt operator +(cs pt &a,cs pt &b){
        return pt(a.x+b.x,a.y+b.y);
    }
    friend inline pt operator -(const pt &a,const pt &b){
        return pt(a.x-b.x,a.y-b.y);
    }
    friend inline ll operator *(const pt &a,const pt &b){
        return 1ll*a.x*b.y-1ll*a.y*b.x;
    }
	friend inline ll operator ^(const pt &a,const pt &b){
		return 1ll*a.x*b.x+1ll*a.y*b.y;
	}
    friend inline bool operator <(const pt &a,const pt &b){
        return (a.x==b.x)?a.y<b.y:a.x<b.x;
    }
};

void solve(){
	cin>>x1>>y1>>z1>>p1>>q1;
	pt v1=pt(p1,q1),A=pt(x1,y1);
	cin>>x2>>y2>>z2>>p2>>q2;
	pt v2=pt(p2,q2),B=pt(x2,y2);
	x2-=x1,y2-=y1,z2-=z1;
	pt C=A-B;
//	cout<<C.x<<" "<<C.y<<" "<<v1.x<<" "<<v1.y<<'\n';
	if((C^v1)==0&&(C^v2)==0)puts("2");
	else{
		int a1=p1,b1=q1,c1=0;
		int a2=-p2,b2=-q2,c2=1ll*p2*x2+1ll*q2*y2;
		if(a1*b2-a2*b1==0){
			puts("4");return;
		}
		long double xx=1.0*(b1*c2+b2*c1)/(a1*b2-a2*b1);
		long double yy;
		if(b1==0){
			yy=-1.0*(a2*xx+c2)/b2;
		}
		else yy=-1.0*(a1*xx+c1)/b1;
	//	cout<<xx<<" "<<yy<<'\n';
		long double del=z2*z2-4*(xx*xx-x2*xx+yy*yy-y2*yy);
		if(del>=0){
			puts("3");
		}
		else puts("4");
	}
}

signed main(){
	#ifdef Stargazer
	freopen("1.in","r",stdin);
	#endif
	int T;cin>>T;
	while(T--)solve();
}

Details

answer.code:28:8: error: ‘long long int y1’ redeclared as different kind of entity
   28 | int x1,y1,z1,p1,q1;
      |        ^~
In file included from /usr/include/features.h:461,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/c++config.h:679,
                 from /usr/include/c++/13/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:33,
                 from answer.code:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:221:1: note: previous declaration ‘double y1(double)’
  221 | __MATHCALL (y1,, (_Mdouble_));
      | ^~~~~~~~~~
answer.code: In function ‘void solve()’:
answer.code:52:16: error: no match for ‘operator>>’ (operand types are ‘std::basic_istream<char>::__istream_type’ {aka ‘std::basic_istream<char>’} and ‘double(double) noexcept’)
   52 |         cin>>x1>>y1>>z1>>p1>>q1;
      |         ~~~~~~~^~~~
      |            |     |
      |            |     double(double) noexcept
      |            std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/13/sstream:40,
                 from /usr/include/c++/13/complex:45,
                 from /usr/include/c++/13/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:127:
/usr/include/c++/13/istream:325:7: note: 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)
      |       ^~~~~~~~
/usr/include/c++/13/istream:325:7: note:   conversion of argument 1 would be ill-formed:
answer.code:52:18: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘void*’ [-fpermissive]
   52 |         cin>>x1>>y1>>z1>>p1>>q1;
      |                  ^~
      |                  |
      |                  double (*)(double) noexcept
answer.code:52:18: error: cannot bind rvalue ‘(void*)y1’ to ‘void*&’
/usr/include/c++/13/istream:201:7: note: 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)
      |       ^~~~~~~~
/usr/include/c++/13/istream:201:7: note:   conversion of argument 1 would be ill-formed:
answer.code:52:18: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘long long unsigned int’ [-fpermissive]
   52 |         cin>>x1>>y1>>z1>>p1>>q1;
      |                  ^~
      |                  |
      |                  double (*)(double) noexcept
answer.code:52:18: error: cannot bind rvalue ‘(long long unsigned int)y1’ to ‘long long unsigned int&’
/usr/include/c++/13/istream:197:7: note: 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)
      |       ^~~~~~~~
/usr/include/c++/13/istream:197:7: note:   conversion of argument 1 would be ill-formed:
answer.code:52:18: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘long long int’ [-fpermissive]
   52 |         cin>>x1>>y1>>z1>>p1>>q1;
      |                  ^~
      |                  |
      |                  double (*)(double) noexcept
answer.code:52:18: error: cannot bind rvalue ‘(long long int)y1’ to ‘long long int&’
/usr/include/c++/13/istream:192:7: note: 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)
      |       ^~~~~~~~
/usr/include/c++/13/istream:192:7: note:   conversion of argument 1 would be ill-formed:
answer.code:52:18: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘long unsigned int’ [-fpermissive]
   52 |         cin>>x1>>y1>>z1>>p1>>q1;
      |                  ^~
      |                  |
      |                  double (*)(double) noexcept
answer.code:52:18: error: cannot bind rvalue ‘(long unsigned int)y1’ to ‘long unsigned int&’
/usr/include/c++/13/istream:188:7: note: 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)
      |       ^~~~~~~~
/usr/include/c++/13/istream:188:7: note:   conversion of argument 1 would be ill-formed:
answer.code:52:18: error: invalid conversion from...