제출 #140171

#제출 시각아이디문제언어결과실행 시간메모리
140171PedroBigMan선물상자 (IOI15_boxes)C++14
컴파일 에러
0 ms0 KiB
#include "boxes.h" #include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <string> using namespace std; typedef long long int ll; typedef unsigned long long int ull; typedef long double ld; #define REP(i,a,b) for(ll i=a; i<b; i++) #define pb push_back #define mp make_pair #define pl pair<ll,ll> #define ff first #define ss second #define INF ((ll) pow(2,63) -1) ll insig; #define In(vecBRO, LENBRO) REP(IBRO,0,LENBRO) {cin>>insig; vecBRO.pb(insig);} void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;} long long delivery(int N, int K, int L, int p[]) { ll ans=0; if(K==1) { REP(i,0,N) { ans+=2*min(p[i],L-p[i]); } } else if(K==N) { ans=min(2*p[N-1],2*(L-p[0])); ans=min(ans,L); REP(i,0,N-1) { ans=min(ans,2*(p[i]+L-p[i+1])); } } return ans; }

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

boxes.cpp: In function 'void Out(std::vector<long long int>)':
boxes.cpp:11:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,a,b) for(ll i=a; i<b; i++)
boxes.cpp:20:29:
 void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}
                             ~~~~~~~~~~~~
boxes.cpp:20:25: note: in expansion of macro 'REP'
 void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}
                         ^~~
boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:34:52: error: no matching function for call to 'min(ll&, int&)'
         ans=min(2*p[N-1],2*(L-p[0])); ans=min(ans,L);
                                                    ^
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/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from boxes.cpp:2:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
boxes.cpp:34:52: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
         ans=min(2*p[N-1],2*(L-p[0])); ans=min(ans,L);
                                                    ^
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/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from boxes.cpp:2:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
boxes.cpp:34:52: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
         ans=min(2*p[N-1],2*(L-p[0])); ans=min(ans,L);
                                                    ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from boxes.cpp:5:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
boxes.cpp:34:52: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
         ans=min(2*p[N-1],2*(L-p[0])); ans=min(ans,L);
                                                    ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from boxes.cpp:5:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
boxes.cpp:34:52: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
         ans=min(2*p[N-1],2*(L-p[0])); ans=min(ans,L);
                                                    ^
boxes.cpp:37:42: error: no matching function for call to 'min(ll&, int)'
             ans=min(ans,2*(p[i]+L-p[i+1]));
                                          ^
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/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from boxes.cpp:2:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
boxes.cpp:37:42: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
             ans=min(ans,2*(p[i]+L-p[i+1]));
                                          ^
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/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from boxes.cpp:2:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
boxes.cpp:37:42: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
             ans=min(ans,2*(p[i]+L-p[i+1]));
                                          ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from boxes.cpp:5:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
boxes.cpp:37:42: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
             ans=min(ans,2*(p[i]+L-p[i+1]));
                                          ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from boxes.cpp:5:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
boxes.cpp:37:42: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
             ans=min(ans,2*(p[i]+L-p[i+1]));
                                          ^