QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#411526#6677. Puzzle: Sashiganele0n#Compile Error//C++17796b2024-05-15 15:24:172024-05-15 15:24:18

Judging History

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

  • [2024-05-15 15:24:18]
  • 评测
  • [2024-05-15 15:24:17]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int NR=1e6+10;
int n,x0,y0,x[NR],y[NR],h[NR],w[NR],tot;
int px[5],py[5],qx[5],qy[5];

int calc(int x){
	if(x&1)return x+1;
	return x-1;
}
int main(){
	cin>>n>>x0>>y0;
	px[1]=py[1]=1;qx[1]=1;qy[1]=1;
	px[2]=1;py[2]=n;qx[2]=1;qy[2]=-1;
	px[3]=n;py[3]=n;qx[3]=-1;qy[3]=-1;
	px[4]=n;py[4]=1;qx[4]=-1;qy[4]=1;
	for(int i=n;i>=2;i--){
		int pos=0;
		for(int j=1;j<=4;j++)
			if(px[j]!=x0&&py[j]!=y0){
				pos=j;
				break;
			}
		tot++;x[tot]=px[pos];y[tot]=py[pos];
		h[tot]=qx[pos]*(i-1);w[tot]=qy[pos]*(i-1);
		py[pos]+=qy[pos];py[5-pos]+=qy[5-pos];
		px[pos]+=qx[pos];px[calc(pos)]+=qx[calc(pos)];
	}
	puts("Yes");
	cout<<tot<<endl;
	for(int i=1;i<=tot;i++)printf("%d %d %d %d\n",x[i],y[i],h[i],w[i]);
	return 0;
} 

Details

answer.code:4:10: error: ‘int y0’ redeclared as different kind of entity
    4 | int n,x0,y0,x[NR],y[NR],h[NR],w[NR],tot;
      |          ^~
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:220:1: note: previous declaration ‘double y0(double)’
  220 | __MATHCALL (y0,, (_Mdouble_));
      | ^~~~~~~~~~
answer.code: In function ‘int main()’:
answer.code:12:19: error: no match for ‘operator>>’ (operand types are ‘std::basic_istream<char>::__istream_type’ {aka ‘std::basic_istream<char>’} and ‘double(double) noexcept’)
   12 |         cin>>n>>x0>>y0;
      |         ~~~~~~~~~~^~~~
      |               |     |
      |               |     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:12:21: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘void*’ [-fpermissive]
   12 |         cin>>n>>x0>>y0;
      |                     ^~
      |                     |
      |                     double (*)(double) noexcept
answer.code:12:21: error: cannot bind rvalue ‘(void*)y0’ 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:12:21: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘long long unsigned int’ [-fpermissive]
   12 |         cin>>n>>x0>>y0;
      |                     ^~
      |                     |
      |                     double (*)(double) noexcept
answer.code:12:21: error: cannot bind rvalue ‘(long long unsigned int)y0’ 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:12:21: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘long long int’ [-fpermissive]
   12 |         cin>>n>>x0>>y0;
      |                     ^~
      |                     |
      |                     double (*)(double) noexcept
answer.code:12:21: error: cannot bind rvalue ‘(long long int)y0’ 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:12:21: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘long unsigned int’ [-fpermissive]
   12 |         cin>>n>>x0>>y0;
      |                     ^~
      |                     |
      |                     double (*)(double) noexcept
answer.code:12:21: error: cannot bind rvalue ‘(long unsigned int)y0’ 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:12:21: error: invalid c...