记录详情

Compile Error

/in/foo.cc: In function 'int main()':
/in/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++/6/string:48:0,
                 from /usr/include/c++/6/bits/locale_classes.h:40,
                 from /usr/include/c++/6/bits/ios_base.h:41,
                 from /usr/include/c++/6/ios:42,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from /in/foo.cc:1:
/usr/include/c++/6/bits/stl_function.h:371:12: note: provided for 'template<class _Tp> struct std::greater'
     struct greater : public binary_function<_Tp, _Tp, bool>
            ^~~~~~~
/in/foo.cc:11:48: error: template argument 3 is invalid
     priority_queue<int, vector<int>, greater<> > queue1;
                                                ^
/in/foo.cc:14:16: error: request for member 'push' in 'queue1', which is of non-class type 'int'
         queue1.push(temp);
                ^~~~
/in/foo.cc:16:19: error: request for member 'size' in 'queue1', which is of non-class type 'int'
     while (queue1.size() > 1) {
                   ^~~~
/in/foo.cc:17:24: error: request for member 'top' in 'queue1', which is of non-class type 'int'
         int a = queue1.top();
                        ^~~
/in/foo.cc:18:16: error: request for member 'pop' in 'queue1', which is of non-class type 'int'
         queue1.pop();
                ^~~
/in/foo.cc:19:24: error: request for member 'top' in 'queue1', which is of non-class type 'int'
         int b = queue1.top();
                        ^~~
/in/foo.cc:20:16: error: request for member 'pop' in 'queue1', which is of non-class type 'int'
         queue1.pop();
                ^~~
/in/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:30
评测时间
2021-01-25 09:34:30
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes