记录详情

Compile Error

foo.cc: In function 'int main()':
foo.cc:11:46: error: wrong number of template arguments (0, should be 1)
     priority_queue<int, vector<int>, greater<> > queue1;
                                              ^
In file included from /usr/include/c++/7/string:48: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 foo.cc:1:
/usr/include/c++/7/bits/stl_function.h:371:12: note: provided for 'template<class _Tp> struct std::greater'
     struct greater : public binary_function<_Tp, _Tp, bool>
            ^~~~~~~
foo.cc:11:48: error: template argument 3 is invalid
     priority_queue<int, vector<int>, greater<> > queue1;
                                                ^
foo.cc:14:16: error: request for member 'push' in 'queue1', which is of non-class type 'int'
         queue1.push(temp);
                ^~~~
foo.cc:16:19: error: request for member 'size' in 'queue1', which is of non-class type 'int'
     while (queue1.size() > 1) {
                   ^~~~
foo.cc:17:24: error: request for member 'top' in 'queue1', which is of non-class type 'int'
         int a = queue1.top();
                        ^~~
foo.cc:18:16: error: request for member 'pop' in 'queue1', which is of non-class type 'int'
         queue1.pop();
                ^~~
foo.cc:19:24: error: request for member 'top' in 'queue1', which is of non-class type 'int'
         int b = queue1.top();
                        ^~~
foo.cc:20:16: error: request for member 'pop' in 'queue1', which is of non-class type 'int'
         queue1.pop();
                ^~~
foo.cc:22:16: error: request for member 'push' in 'queue1', which is of non-class type 'int'
         queue1.push(a + b);
                ^~~~

信息

递交者
类型
递交
题目
P1162 合并果子
语言
C++
递交时间
2021-01-25 09:34:39
评测时间
2021-01-25 09:34:39
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes