제출 #167858

#제출 시각아이디문제언어결과실행 시간메모리
167858stefdascaGap (APIO16_gap)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "gap.h" using namespace std; int v[100002]; long long findGap(int T, int N) { long long ans = 0; if(T == 1) { int a = 1; int b = n; long long st = 0; long long dr = 1; for(int i = 1; i <= 18; ++i) dr = dr * 10LL; while(a <= b) { long long st2 = st; long long dr2 = dr; MinMax(st, dr, st2, dr2); v[a] = st2; v[b] = dr2; ++a; --b; st = st2; dr = dr2; } for(int i = 1; i < n; ++i) ans = max(ans, v[i+1] - v[i]); } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:13:17: error: 'n' was not declared in this scope
         int b = n;
                 ^
gap.cpp:22:36: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
             MinMax(st, dr, st2, dr2);
                                    ^
In file included from gap.cpp:2:0:
gap.h:1:6: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^~~~~~
gap.cpp:22:36: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
             MinMax(st, dr, st2, dr2);
                                    ^
In file included from gap.cpp:2:0:
gap.h:1:6: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^~~~~~
gap.cpp:31:41: error: no matching function for call to 'max(long long int&, int)'
             ans = max(ans, v[i+1] - v[i]);
                                         ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from gap.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:219:5: note:   template argument deduction/substitution failed:
gap.cpp:31:41: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
             ans = max(ans, v[i+1] - v[i]);
                                         ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from gap.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:265:5: note:   template argument deduction/substitution failed:
gap.cpp:31:41: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
             ans = max(ans, v[i+1] - v[i]);
                                         ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from gap.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3462:5: note: candidate: template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)
     max(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
gap.cpp:31:41: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
             ans = max(ans, v[i+1] - v[i]);
                                         ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from gap.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3468:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
gap.cpp:31:41: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
             ans = max(ans, v[i+1] - v[i]);
                                         ^