# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
149126 | Little Piplup (#200) | 십자가 놓기 (FXCUP4_cross) | C++17 | 컴파일 에러 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cross.h"
#include<bits/stdc++.h>
//using namespace std;
long long SelectCross(int K, std::vector<int> I, std::vector<int> O) {
int N = I.size();
std::pair<long long, long long> soo[N];
for ( int i = 0 ; i < N ; ++i ) {
soo[i] = {O[i], I[i]};
}
sort(soo, soo + N, std::greater< std::pair<long long, long long> >());
std::priority_queue<long long, std::vector<long long>, std::greater<long long>()> puts;
for ( int i = 0 ; i < K ; ++i ) {
puts.push(soo[i].second);
}
long long out = soo[K-1].first;
long long in = puts.top();
long long ret = out * out - in * in;
for ( int i = K ; i < N ; ++i ) {
out = soo[i].first;
puts.pop();
puts.push(soo[i].second);
in = puts.top();
ret = std::max(ret, out * out - in * in);
}
return ret;
}
컴파일 시 표준 에러 (stderr) 메시지
In file included from /usr/include/c++/7/queue:64:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86, from cross.cpp:2: /usr/include/c++/7/bits/stl_queue.h: In instantiation of 'class std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int>()>': cross.cpp:14:84: required from here /usr/include/c++/7/bits/stl_queue.h:457:18: error: field 'std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int>()>::comp' invalidly declared function type _Compare comp; ^~~~ cross.cpp: In function 'long long int SelectCross(int, std::vector<int>, std::vector<int>)': cross.cpp:14:84: error: no matching function for call to 'std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int>()>::priority_queue()' std::priority_queue<long long, std::vector<long long>, std::greater<long long>()> puts; ^~~~ In file included from /usr/include/c++/7/queue:64:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86, from cross.cpp:2: /usr/include/c++/7/bits/stl_queue.h:552:2: note: candidate: template<class _InputIterator> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, _Sequence&&) priority_queue(_InputIterator __first, _InputIterator __last, ^~~~~~~~~~~~~~ /usr/include/c++/7/bits/stl_queue.h:552:2: note: template argument deduction/substitution failed: cross.cpp:14:84: note: candidate expects 4 arguments, 0 provided std::priority_queue<long long, std::vector<long long>, std::greater<long long>()> puts; ^~~~ In file included from /usr/include/c++/7/queue:64:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86, from cross.cpp:2: /usr/include/c++/7/bits/stl_queue.h:541:2: note: candidate: template<class _InputIterator> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, const _Sequence&) priority_queue(_InputIterator __first, _InputIterator __last, ^~~~~~~~~~~~~~ /usr/include/c++/7/bits/stl_queue.h:541:2: note: template argument deduction/substitution failed: cross.cpp:14:84: note: candidate expects 4 arguments, 0 provided std::priority_queue<long long, std::vector<long long>, std::greater<long long>()> puts; ^~~~ In file included from /usr/include/c++/7/queue:64:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86, from cross.cpp:2: /usr/include/c++/7/bits/stl_queue.h:509:2: note: candidate: template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(std::priority_queue<_Tp, _Sequence, _Compare>&&, const _Alloc&) priority_queue(priority_queue&& __q, const _Alloc& __a) ^~~~~~~~~~~~~~ /usr/include/c++/7/bits/stl_queue.h:509:2: note: template argument deduction/substitution failed: cross.cpp:14:84: note: candidate expects 2 arguments, 0 provided std::priority_queue<long long, std::vector<long long>, std::greater<long long>()> puts; ^~~~ In file included from /usr/include/c++/7/queue:64:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86, from cross.cpp:2: /usr/include/c++/7/bits/stl_queue.h:505:2: note: candidate: template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const std::priority_queue<_Tp, _Sequence, _Compare>&, const _Alloc&) priority_queue(const priority_queue& __q, const _Alloc& __a) ^~~~~~~~~~~~~~ /usr/include/c++/7/bits/stl_queue.h:505:2: note: template argument deduction/substitution failed: cross.cpp:14:84: note: candidate expects 2 arguments, 0 provided std::priority_queue<long long, std::vector<long long>, std::greater<long long>()> puts; ^~~~ In file included from /usr/include/c++/7/queue:64:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86, from cross.cpp:2: /usr/include/c++/7/bits/stl_queue.h:501:2: note: candidate: template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, _Sequence&&, const _Alloc&) priority_queue(const _Compare& __x, _Sequence&& __c, const _Alloc& __a) ^~~~~~~~~~~~~~ /usr/include/c++/7/bits/stl_queue.h:501:2: note: template argument deduction/substitution failed: cross.cpp:14:84: note: candidate expects 3 arguments, 0 provided std::priority_queue<long long, std::vector<long long>, std::greater<long long>()> puts; ^~~~ In file included from /usr/include/c++/7/queue:64:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86, from cross.cpp:2: /usr/include/c++/7/bits/stl_queue.h:496:2: note: candidate: template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, const _Sequence&, const _Alloc&) priority_queue(const _Compare& __x, const _Sequence& __c, ^~~~~~~~~~~~~~ /usr/include/c++/7/bits/stl_queue.h:496:2: note: template argument deduction/substitution failed: cross.cpp:14:84: note: candidate expects 3 arguments, 0 provided std::priority_queue<long long, std::vector<long long>, std::greater<long long>()> puts; ^~~~ In file included from /usr/include/c++/7/queue:64:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86, from cross.cpp:2: /usr/include/c++/7/bits/stl_queue.h:492:2: note: candidate: template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, const _Alloc&) priority_queue(const _Compare& __x, const _Alloc& __a) ^~~~~~~~~~~~~~ /usr/include/c++/7/bits/stl_queue.h:492:2: note: template argument deduction/substitution failed: cross.cpp:14:84: note: candidate expects 2 arguments, 0 provided std::priority_queue<long long, std::vector<long long>, std::greater<long long>()> puts; ^~~~ In file included from /usr/include/c++/7/queue:64:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86, from cross.cpp:2: /usr/include/c++/7/bits/stl_queue.h:488:2: note: candidate: template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Alloc&) priority_queue(const _Alloc& __a) ^~~~~~~~~~~~~~ /usr/include/c++/7/bits/stl_queue.h:488:2: note: template argument deduction/substitution failed: cross.cpp:14:84: note: candidate expects 1 argument, 0 provided std::priority_queue<long long, std::vector<long long>, std::greater<long long>()> puts; ^~~~ In file included from /usr/include/c++/7/queue:64:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86, from cross.cpp:2: /usr/include/c++/7/bits/stl_queue.h:482:7: note: candidate: std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, _Sequence&&) [with _Tp = long long int; _Sequence = std::vector<long long int>; _Compare = std::greater<long long int>()] priority_queue(const _Compare& __x, _Sequence&& __s = _Sequence()) ^~~~~~~~~~~~~~ /usr/include/c++/7/bits/stl_queue.h:482:7: note: candidate expects 2 arguments, 0 provided /usr/include/c++/7/bits/stl_queue.h:477:7: note: candidate: std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, const _Sequence&) [with _Tp = long long int; _Sequence = std::vector<long long int>; _Compare = std::greater<long long int>()] priority_queue(const _Compare& __x, const _Sequence& __s) ^~~~~~~~~~~~~~ /usr/include/c++/7/bits/stl_queue.h:477:7: note: candidate expects 2 arguments, 0 provided /usr/include/c++/7/bits/stl_queue.h:473:2: note: candidate: template<class _Seq, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue() priority_queue() ^~~~~~~~~~~~~~ /usr/include/c++/7/bits/stl_queue.h:473:2: note: template argument deduction/substitution failed: /usr/include/c++/7/bits/stl_queue.h:470:43: error: no type named 'type' in 'struct std::enable_if<false, void>' template<typename _Seq = _Sequence, typename _Requires = typename ^~~~~~~~ /usr/include/c++/7/bits/stl_queue.h:423:11: note: candidate: std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int>()>::priority_queue(const std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int>()>&) class priority_queue ^~~~~~~~~~~~~~ /usr/include/c++/7/bits/stl_queue.h:423:11: note: candidate expects 1 argument, 0 provided /usr/include/c++/7/bits/stl_queue.h:423:11: note: candidate: std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int>()>::priority_queue(std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int>()>&&) /usr/include/c++/7/bits/stl_queue.h:423:11: note: candidate expects 1 argument, 0 provided In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0, from /usr/include/c++/7/vector:60, from cross.h:2, from cross.cpp:1: /usr/include/c++/7/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_comp_val<_Compare>::operator()(_Iterator, _Value&) [with _Iterator = __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >; _Value = long long int; _Compare = std::greater<long long int> (*)()]': /usr/include/c++/7/bits/stl_heap.h:133:48: required from 'void std::__push_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >; _Distance = long int; _Tp = long long int; _Compare = __gnu_cxx::__ops::_Iter_comp_val<std::greater<long long int> (*)()>]' /usr/include/c++/7/bits/stl_heap.h:207:23: required from 'void std::push_heap(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >; _Compare = std::greater<long long int> (*)()]' /usr/include/c++/7/bits/stl_queue.h:598:16: required from 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = long long int; _Sequence = std::vector<long long int>; _Compare = std::greater<long long int>(); std::priority_queue<_Tp, _Sequence, _Compare>::value_type = long long int]' cross.cpp:16:26: required from here /usr/include/c++/7/bits/predefined_ops.h:177:11: error: too many arguments to function { return bool(_M_comp(*__it, __val)); } ^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/7/bits/predefined_ops.h:177:11: error: invalid cast from type 'std::greater<long long int>' to type 'bool' /usr/include/c++/7/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >; _Iterator2 = __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >; _Compare = std::greater<long long int> (*)()]': /usr/include/c++/7/bits/stl_heap.h:222:14: required from 'void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >; _Distance = long int; _Tp = long long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<std::greater<long long int> (*)()>]' /usr/include/c++/7/bits/stl_heap.h:253:25: required from 'void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<std::greater<long long int> (*)()>]' /usr/include/c++/7/bits/stl_heap.h:320:19: required from 'void std::pop_heap(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >; _Compare = std::greater<long long int> (*)()]' /usr/include/c++/7/bits/stl_queue.h:633:15: required from 'void std::priority_queue<_Tp, _Sequence, _Compare>::pop() [with _Tp = long long int; _Sequence = std::vector<long long int>; _Compare = std::greater<long long int>()]' cross.cpp:24:12: required from here /usr/include/c++/7/bits/predefined_ops.h:143:18: error: too many arguments to function { return bool(_M_comp(*__it1, *__it2)); } ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/7/bits/predefined_ops.h:143:18: error: invalid cast from type 'std::greater<long long int>' to type 'bool'