神奇咕咕
查看原帖
神奇咕咕
1094294
linmingjia楼主2024/8/22 17:18
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<iomanip>
using namespace std;
int n,m,t,x1,x2,y1,y2,what,a[1015][1015],sum,x[1015],y[1015],o=1;
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) cin>>a[i][j];
	cin>>t;
	for(int i=1;i<=t;i++)
	{
		cin>>x1>>x2>>y1>>y2;
		what=a[x1][x2];
		a[x1][x2]=a[y1][y2];
		a[y1][y2]=what;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(a[i][j]>a[i-1][j]&&a[i][j]>a[i][j-1]&&a[i][j]>a[i][j+1]&&a[i][j]>a[i+1][j])
			{
				x[o]=i;
				y[o]=j;
				sum++;
				o++;
			}
		}
	}
	cout<<sum;
	if(sum!=0)
	{
		cout<<endl;
		for(int i=1;i<o;i++) cout<<x[i]<<" "<<y[i]<<endl;
	}
	return 0;
}

以上代码Dev-C++能跑,为啥咕咕就CE了??? 编译信息(咕咕)

/tmp/compiler_s4kqjg1y/src:9:17: 错误:‘int y1’ redeclared as different kind of entity
    9 | int n,m,t,x1,x2,y1,y2,what,a[1015][1015],sum,x[1015],y[1015],o=1;
      |                 ^~
In file included from /nix/store/79624djlfdc0a6anji2rwqd9p9ycqi8h-glibc-2.34-210-dev/include/features.h:490,
                 from /nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/x86_64-unknown-linux-gnu/bits/os_defines.h:39,
                 from /nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/x86_64-unknown-linux-gnu/bits/c++config.h:524,
                 from /nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/iostream:38,
                 from /tmp/compiler_s4kqjg1y/src:1:
/nix/store/79624djlfdc0a6anji2rwqd9p9ycqi8h-glibc-2.34-210-dev/include/bits/mathcalls.h:224:1: 附注:previous declaration ‘double y1(double)’
  224 | __MATHCALL (y1,, (_Mdouble_));
      | ^~~~~~~~~~
/tmp/compiler_s4kqjg1y/src: 在函数‘int main()’中:
/tmp/compiler_s4kqjg1y/src:17:14: 错误: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)’})
   17 |   cin>>x1>>x2>>y1>>y2;
      |   ~~~~~~~~~~~^~~~
      |          |     |
      |          |     double(double) noexcept {aka double(double)}
      |          std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/iostream:40,
                 from /tmp/compiler_s4kqjg1y/src:1:
/nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/istream:120:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__istream_type& (*)(std::basic_istream<_CharT, _Traits>::__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ <near match>
  120 |       operator>>(__istream_type& (*__pf)(__istream_type&))
      |       ^~~~~~~~
/nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/istream:120:7: 附注:  conversion of argument 1 would be ill-formed:
/tmp/compiler_s4kqjg1y/src:17:16: 错误:invalid conversion from ‘double (*)(double) noexcept’ {aka ‘double (*)(double)’} to ‘std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)’ {aka ‘std::basic_istream<char>& (*)(std::basic_istream<char>&)’} [-fpermissive]
   17 |   cin>>x1>>x2>>y1>>y2;
      |                ^~
      |                |
      |                double (*)(double) noexcept {aka double (*)(double)}
In file included from /nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/iostream:40,
                 from /tmp/compiler_s4kqjg1y/src:1:
/nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/istream:124:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__ios_type& (*)(std::basic_istream<_CharT, _Traits>::__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>; std::basic_istream<_CharT, _Traits>::__ios_type = std::basic_ios<char>]’ <near match>
  124 |       operator>>(__ios_type& (*__pf)(__ios_type&))
      |       ^~~~~~~~
/nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/istream:124:7: 附注:  conversion of argument 1 would be ill-formed:
/tmp/compiler_s4kqjg1y/src:17:16: 错误:invalid conversion from ‘double (*)(double) noexcept’ {aka ‘double (*)(double)’} to ‘std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)’ {aka ‘std::basic_ios<char>& (*)(std::basic_ios<char>&)’} [-fpermissive]
   17 |   cin>>x1>>x2>>y1>>y2;
      |                ^~
      |                |
      |                double (*)(double) noexcept {aka double (*)(double)}
In file included from /nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/iostream:40,
                 from /tmp/compiler_s4kqjg1y/src:1:
/nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/istream:131:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ <near match>
  131 |       operator>>(ios_base& (*__pf)(ios_base&))
      |       ^~~~~~~~
/nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/istream:131:7: 附注:  conversion of argument 1 would be ill-formed:
/tmp/compiler_s4kqjg1y/src:17:16: 错误:invalid conversion from ‘double (*)(double) noexcept’ {aka ‘double (*)(double)’} to ‘std::ios_base& (*)(std::ios_base&)’ [-fpermissive]
   17 |   cin>>x1>>x2>>y1>>y2;
      |                ^~
      |                |
      |                double (*)(double) noexcept {aka double (*)(double)}
In file included from /nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/iostream:40,
                 from /tmp/compiler_s4kqjg1y/src:1:
/nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/istream:168:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ <near match>
  168 |       operator>>(bool& __n)
      |       ^~~~~~~~
/nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/istream:168:7: 附注:  conversion of argument 1 would be ill-formed:
/tmp/compiler_s4kqjg1y/src:17:16: 警告:‘double y1(double)’的地址永远不会为 NULL [-Waddress]
   17 |   cin>>x1>>x2>>y1>>y2;
      |                ^~
/tmp/compiler_s4kqjg1y/src:17:16: 错误:cannot bind non-const lvalue reference of type ‘bool&’ to an rvalue of type ‘bool’
In file included from /nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/iostream:40,
                 from /tmp/compiler_s4kqjg1y/src:1:
/nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/istream:172:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]’ <near match>
  172 |       operator>>(short& __n);
      |       ^~~~~~~~
/nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/istream:172:7: 附注:  conversion of argument 1 would be ill-formed:
/tmp/compiler_s4kqjg1y/src:17:16: 错误:invalid conversion from ‘double (*)(double) noexcept’ {aka ‘double (*)(double)’} to ‘short int’ [-fpermissive]
   17 |   cin>>x1>>x2>>y1>>y2;
      |                ^~
      |                |
      |                double (*)(double) noexcept {aka double (*)(double)}
/tmp/compiler_s4kqjg1y/src:17:16: 错误:无法将右值‘(short int)y1’绑定到‘short int&’
In file included from /nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/iostream:40,
                 from /tmp/compiler_s4kqjg1y/src:1:
/nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/istream:175: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>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ <near match>
  175 |       operator>>(unsigned short& __n)
      |       ^~~~~~~~
/nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/istream:175:7: 附注:  conversion of argument 1 would be ill-formed:
/tmp/compiler_s4kqjg1y/src:17:16: 错误:invalid conversion from ‘double (*)(double) noexcept’ {aka ‘double (*)(double)’} to ‘short unsigned int’ [-fpermissive]
   17 |   cin>>x1>>x2>>y1>>y2;
      |                ^~
      |                |
      |                double (*)(double) noexcept {aka double (*)(double)}
/tmp/compiler_s4kqjg1y/src:17:16: 错误:无法将右值‘(short unsigned int)y1’绑定到‘short unsigned int&’
In file included from /nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/iostream:40,
                 from /tmp/compiler_s4kqjg1y/src:1:
/nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/istream:179:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]’ <near match>
  179 |       operator>>(int& __n);
      |       ^~~~~~~~
/nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/istream:179:7: 附注:  conversion of argument 1 would be ill-formed:
/tmp/compiler_s4kqjg1y/src:17:16: 错误:invalid conversion from ‘double (*)(double) noexcept’ {aka ‘double (*)(double)’} to ‘int’ [-fpermissive]
   17 |   cin>>x1>>x2>>y1>>y2;
      |                ^~
      |                |
      |                double (*)(double) noexcept {aka double (*)(double)}
/tmp/compiler_s4kqjg1y/src:17:16: 错误:无法将右值‘(int)y1’绑定到‘int&’
In file included from /nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/iostream:40,
                 from /tmp/compiler_s4kqjg1y/src:1:
/nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/istream:182: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>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ <near match>
  182 |       operator>>(unsigned int& __n)
      |       ^~~~~~~~
/nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/istream:182:7: 附注:  conversion of argument 1 would be ill-formed:
/tmp/compiler_s4kqjg1y/src:17:16: 错误:invalid conversion from ‘double (*)(double
...

有更优解欢迎神犇指出

2024/8/22 17:18
加载中...