Submission #1049956

# Submission time Handle Problem Language Result Execution time Memory
1049956 2024-08-09T06:21:47 Z 김은성(#11046) Hamburg Steak (JOI20_hamburg) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3fffffff;
int x1[200009], y1[200009], x2[200009], y2[200009];
int main(){
	int n, k, i, mnx2 = INF, mxx1 = 0, mny2 = INF, mxy1 = 0;
	scanf("%d %d", &n, &k);
	for(i=1; i<=n; i++){
		scanf("%d %d", &x1[i], &y1[i]);
		scanf("%d %d", &x2[i], &y2[i]);
		mnx2 = min(mnx2, x2[i]);
		mxx1 = max(mxx1, x1[i]);
		mny2 = min(mny2, y2[i]);
		mxy1 = max(mxy1, y1[i]);
	}
	printf("%d %d\n", mnx2, mny2);
	return 0;
}

Compilation message

hamburg.cpp:4:26: error: 'int y1 [200009]' redeclared as different kind of entity
    4 | int x1[200009], y1[200009], x2[200009], y2[200009];
      |                          ^
In file included from /usr/include/features.h:461,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/c++config.h:518,
                 from /usr/include/c++/10/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from hamburg.cpp:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:221:1: note: previous declaration 'double y1(double)'
  221 | __MATHCALL (y1,, (_Mdouble_));
      | ^~~~~~~~~~
hamburg.cpp: In function 'int main()':
hamburg.cpp:9:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
    9 |   scanf("%d %d", &x1[i], &y1[i]);
      |                               ^
hamburg.cpp:9:14: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'double (*)(double) noexcept' [-Wformat=]
    9 |   scanf("%d %d", &x1[i], &y1[i]);
      |             ~^           ~~~~~~
      |              |           |
      |              int*        double (*)(double) noexcept
hamburg.cpp:14:24: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   14 |   mxy1 = max(mxy1, y1[i]);
      |                        ^
hamburg.cpp:14:25: error: no matching function for call to 'max(int&, double (&)(double) noexcept)'
   14 |   mxy1 = max(mxy1, y1[i]);
      |                         ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from hamburg.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
hamburg.cpp:14:25: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'double(double) noexcept')
   14 |   mxy1 = max(mxy1, y1[i]);
      |                         ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from hamburg.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
hamburg.cpp:14:25: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'double(double) noexcept')
   14 |   mxy1 = max(mxy1, y1[i]);
      |                         ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from hamburg.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
hamburg.cpp:14:25: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   14 |   mxy1 = max(mxy1, y1[i]);
      |                         ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from hamburg.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
hamburg.cpp:14:25: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   14 |   mxy1 = max(mxy1, y1[i]);
      |                         ^
hamburg.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |  scanf("%d %d", &n, &k);
      |  ~~~~~^~~~~~~~~~~~~~~~~
hamburg.cpp:9:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |   scanf("%d %d", &x1[i], &y1[i]);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
hamburg.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |   scanf("%d %d", &x2[i], &y2[i]);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~