/ Vijos /

记录详情

Compile Error

foo.cc: In function 'int main()':
foo.cc:11:49: error: wrong number of template arguments (0, should be 1)
   11 |         priority_queue<int, vector<int>, greater<>> a; //优先队列 升序  greater<> -> less<> 则为降序
      |                                                 ^
In file included from /nix/store/jdc41bl531bw84wi82y6gvij34q5m24a-gcc-11.3.0/include/c++/11.3.0/string:48,
                 from /nix/store/jdc41bl531bw84wi82y6gvij34q5m24a-gcc-11.3.0/include/c++/11.3.0/bits/locale_classes.h:40,
                 from /nix/store/jdc41bl531bw84wi82y6gvij34q5m24a-gcc-11.3.0/include/c++/11.3.0/bits/ios_base.h:41,
                 from /nix/store/jdc41bl531bw84wi82y6gvij34q5m24a-gcc-11.3.0/include/c++/11.3.0/ios:42,
                 from /nix/store/jdc41bl531bw84wi82y6gvij34q5m24a-gcc-11.3.0/include/c++/11.3.0/ostream:38,
                 from iostream:39:
/nix/store/jdc41bl531bw84wi82y6gvij34q5m24a-gcc-11.3.0/include/c++/11.3.0/bits/stl_function.h:385:12: note: provided for 'template<class _Tp> struct std::greater'
  385 |     struct greater : public binary_function<_Tp, _Tp, bool>
      |            ^~~~~~~
foo.cc:11:50: error: template argument 3 is invalid
   11 |         priority_queue<int, vector<int>, greater<>> a; //优先队列 升序  greater<> -> less<> 则为降序
      |                                                  ^~
foo.cc:17:19: error: request for member 'push' in 'a', which is of non-class type 'int'
   17 |                 a.push(a1);
      |                   ^~~~
foo.cc:23:23: error: request for member 'top' in 'a', which is of non-class type 'int'
   23 |                 x = a.top();
      |                       ^~~
foo.cc:24:19: error: request for member 'pop' in 'a', which is of non-class type 'int'
   24 |                 a.pop();
      |                   ^~~
foo.cc:25:23: error: request for member 'top' in 'a', which is of non-class type 'int'
   25 |                 y = a.top();
      |                       ^~~
foo.cc:26:19: error: request for member 'pop' in 'a', which is of non-class type 'int'
   26 |                 a.pop();
      |                   ^~~
foo.cc:28:19: error: request for member 'push' in 'a', which is of non-class type 'int'
   28 |                 a.push(x + y);
      |                   ^~~~
foo.cc:29:23: error: request for member 'size' in 'a', which is of non-class type 'int'
   29 |                 if (a.size() == 1)
      |                       ^~~~
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
P1097 合并果子
语言
C++
递交时间
2022-08-26 17:07:17
评测时间
2022-08-26 17:07:17
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes