제출 #189082

#제출 시각아이디문제언어결과실행 시간메모리
189082PedroBigManAliens (IOI16_aliens)C++14
컴파일 에러
0 ms0 KiB
#include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <string> #include <map> #include <set> #include <queue> #include <deque> #include "aliens.h" 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 100000000000000000LL 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;} ll N,M,K; vector<ll> p; ll f(ll a,ll b) { if(a<=0) {return 0LL;} if(b<=0) {return INF;} ll ans=INF; REP(i,0,a) { ans=min(ans,(p[a]-p[i]+1)*(p[a]-p[i]+1)+f(i-1,b-1)); } return ans; } ll take_photos(int n, int m, int k, vector<int> r, vector<int> c) { N=(ll) n; M=(ll) m; K=(ll) k; REP(i,0,N) {p.pb((ll) r[i]);} sort(p,begin(),p.end()); return f(N,K); }

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

aliens.cpp: In function 'void Out(std::vector<long long int>)':
aliens.cpp:15:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,a,b) for(ll i=a; i<b; i++)
aliens.cpp:24:29:
 void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}
                             ~~~~~~~~~~~~
aliens.cpp:24:25: note: in expansion of macro 'REP'
 void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}
                         ^~~
aliens.cpp: In function 'll take_photos(int, int, int, std::vector<int>, std::vector<int>)':
aliens.cpp:42:18: error: no matching function for call to 'begin()'
     sort(p,begin(),p.end());
                  ^
In file included from /usr/include/c++/7/bits/range_access.h:36:0,
                 from /usr/include/c++/7/string:51,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from aliens.cpp:1:
/usr/include/c++/7/initializer_list:89:5: note: candidate: template<class _Tp> constexpr const _Tp* std::begin(std::initializer_list<_Tp>)
     begin(initializer_list<_Tp> __ils) noexcept
     ^~~~~
/usr/include/c++/7/initializer_list:89:5: note:   template argument deduction/substitution failed:
aliens.cpp:42:18: note:   candidate expects 1 argument, 0 provided
     sort(p,begin(),p.end());
                  ^
In file included from /usr/include/c++/7/string:51:0,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from aliens.cpp:1:
/usr/include/c++/7/bits/range_access.h:48:5: note: candidate: template<class _Container> decltype (__cont.begin()) std::begin(_Container&)
     begin(_Container& __cont) -> decltype(__cont.begin())
     ^~~~~
/usr/include/c++/7/bits/range_access.h:48:5: note:   template argument deduction/substitution failed:
aliens.cpp:42:18: note:   candidate expects 1 argument, 0 provided
     sort(p,begin(),p.end());
                  ^
In file included from /usr/include/c++/7/string:51:0,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from aliens.cpp:1:
/usr/include/c++/7/bits/range_access.h:58:5: note: candidate: template<class _Container> decltype (__cont.begin()) std::begin(const _Container&)
     begin(const _Container& __cont) -> decltype(__cont.begin())
     ^~~~~
/usr/include/c++/7/bits/range_access.h:58:5: note:   template argument deduction/substitution failed:
aliens.cpp:42:18: note:   candidate expects 1 argument, 0 provided
     sort(p,begin(),p.end());
                  ^
In file included from /usr/include/c++/7/string:51:0,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from aliens.cpp:1:
/usr/include/c++/7/bits/range_access.h:87:5: note: candidate: template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::begin(_Tp (&)[_Nm])
     begin(_Tp (&__arr)[_Nm])
     ^~~~~
/usr/include/c++/7/bits/range_access.h:87:5: note:   template argument deduction/substitution failed:
aliens.cpp:42:18: note:   candidate expects 1 argument, 0 provided
     sort(p,begin(),p.end());
                  ^
In file included from /usr/include/c++/7/string:51:0,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from aliens.cpp:1:
/usr/include/c++/7/bits/range_access.h:104:31: note: candidate: template<class _Tp> _Tp* std::begin(std::valarray<_Tp>&)
   template<typename _Tp> _Tp* begin(valarray<_Tp>&);
                               ^~~~~
/usr/include/c++/7/bits/range_access.h:104:31: note:   template argument deduction/substitution failed:
aliens.cpp:42:18: note:   candidate expects 1 argument, 0 provided
     sort(p,begin(),p.end());
                  ^
In file included from /usr/include/c++/7/string:51:0,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from aliens.cpp:1:
/usr/include/c++/7/bits/range_access.h:105:37: note: candidate: template<class _Tp> const _Tp* std::begin(const std::valarray<_Tp>&)
   template<typename _Tp> const _Tp* begin(const valarray<_Tp>&);
                                     ^~~~~
/usr/include/c++/7/bits/range_access.h:105:37: note:   template argument deduction/substitution failed:
aliens.cpp:42:18: note:   candidate expects 1 argument, 0 provided
     sort(p,begin(),p.end());
                  ^