# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
242065 | michao | Gap (APIO16_gap) | C++14 | 컴파일 에러 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
typedef long long ll;
#define pb push_back
int n;
vector<ll>pom,answer;
long long findGap(int t, int N)
{
n=N;
int ans=0;
int ip=-1,ik=inf;
if (t==1)
{
while (sz(answer)+sz(pom)<n)
{
ip++,ik--;
MinMax(ip,ik,&ip,&ik);
answer.pb(ip);
pom.pb(ik);
}
}
else
{
assert(false);
}
while (sz(pom)>0)answer.pb(pom.back()),pom.pop_back();
for (int i=0;i<sz(answer)-1;i++)ans=max(ans,answer[i+1]-answer[i]);
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
gap.cpp: In function 'long long int findGap(int, int)': gap.cpp:12:15: error: 'inf' was not declared in this scope int ip=-1,ik=inf; ^~~ gap.cpp:12:15: note: suggested alternative: 'ynf' int ip=-1,ik=inf; ^~~ ynf gap.cpp:15:10: error: 'sz' was not declared in this scope while (sz(answer)+sz(pom)<n) ^~ gap.cpp:18:24: error: cannot convert 'int*' to 'long long int*' for argument '3' to 'void MinMax(long long int, long long int, long long int*, long long int*)' MinMax(ip,ik,&ip,&ik); ^ gap.cpp:27:9: error: 'sz' was not declared in this scope while (sz(pom)>0)answer.pb(pom.back()),pom.pop_back(); ^~ gap.cpp:28:17: error: 'sz' was not declared in this scope for (int i=0;i<sz(answer)-1;i++)ans=max(ans,answer[i+1]-answer[i]); ^~ gap.cpp:28:67: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type)' for (int i=0;i<sz(answer)-1;i++)ans=max(ans,answer[i+1]-answer[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:28:67: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type {aka long long int}') for (int i=0;i<sz(answer)-1;i++)ans=max(ans,answer[i+1]-answer[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:28:67: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type {aka long long int}') for (int i=0;i<sz(answer)-1;i++)ans=max(ans,answer[i+1]-answer[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:28:67: note: mismatched types 'std::initializer_list<_Tp>' and 'int' for (int i=0;i<sz(answer)-1;i++)ans=max(ans,answer[i+1]-answer[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:28:67: note: mismatched types 'std::initializer_list<_Tp>' and 'int' for (int i=0;i<sz(answer)-1;i++)ans=max(ans,answer[i+1]-answer[i]); ^