제출 #167859

#제출 시각아이디문제언어결과실행 시간메모리
167859stefdascaGap (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; long long *dr2; 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:23:20: error: invalid conversion from 'long long int*' to 'int' [-fpermissive]
             v[a] = st2;
                    ^~~
gap.cpp:24:20: error: invalid conversion from 'long long int*' to 'int' [-fpermissive]
             v[b] = dr2;
                    ^~~
gap.cpp:27:18: error: invalid conversion from 'long long int*' to 'long long int' [-fpermissive]
             st = st2;
                  ^~~
gap.cpp:28:18: error: invalid conversion from 'long long int*' to 'long long int' [-fpermissive]
             dr = dr2;
                  ^~~
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]);
                                         ^