记录详情

Compile Error

foo.cc:4:9: error: 'pair' does not name a type
    4 | typedef pair<string,int> Pll;
      |         ^~~~
foo.cc: In function 'int main()':
foo.cc:8:2: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    8 |  vector<Pll>a;
      |  ^~~~~~
      |  std::vector
In file included from /usr/include/c++/9/vector:67,
                 from foo.cc:2:
/usr/include/c++/9/bits/stl_vector.h:386:11: note: 'std::vector' declared here
  386 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
foo.cc:8:9: error: 'Pll' was not declared in this scope
    8 |  vector<Pll>a;
      |         ^~~
foo.cc:8:13: error: 'a' was not declared in this scope
    8 |  vector<Pll>a;
      |             ^
foo.cc:10:2: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   10 |  cin>>n;
      |  ^~~
      |  std::cin
In file included from foo.cc:1:
/usr/include/c++/9/iostream:60:18: note: 'std::cin' declared here
   60 |   extern istream cin;  /// Linked to standard input
      |                  ^~~
foo.cc:13:6: error: expected ';' before 'x'
   13 |   Pll x;
      |      ^~
      |      ;
foo.cc:14:8: error: 'x' was not declared in this scope
   14 |   cin>>x.first>>x.second;
      |        ^
foo.cc:20:5: error: 'swap' was not declared in this scope
   20 |     swap(a[j-1],a[j]);
      |     ^~~~
foo.cc:20:5: note: suggested alternatives:
In file included from /usr/include/c++/9/vector:68,
                 from foo.cc:2:
/usr/include/c++/9/bits/stl_bvector.h:134:3: note:   'std::swap'
  134 |   swap(bool& __x, _Bit_reference __y) noexcept
      |   ^~~~
In file included from /usr/include/c++/9/exception:143,
                 from /usr/include/c++/9/ios:39,
                 from /usr/include/c++/9/ostream:38,
                 from /usr/include/c++/9/iostream:39,
                 from foo.cc:1:
/usr/include/c++/9/bits/exception_ptr.h:166:5: note:   'std::__exception_ptr::swap'
  166 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~
In file included from /usr/include/c++/9/bits/nested_exception.h:40,
                 from /usr/include/c++/9/exception:144,
                 from /usr/include/c++/9/ios:39,
                 from /usr/include/c++/9/ostream:38,
                 from /usr/include/c++/9/iostream:39,
                 from foo.cc:1:
/usr/include/c++/9/bits/move.h:182:5: note:   'std::swap'
  182 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
foo.cc:23:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   23 |   cout<<a[i].first<<" "<<a[i].second<<endl;
      |   ^~~~
      |   std::cout
In file included from foo.cc:1:
/usr/include/c++/9/iostream:61:18: note: 'std::cout' declared here
   61 |   extern ostream cout;  /// Linked to standard output
      |                  ^~~~
foo.cc:23:39: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   23 |   cout<<a[i].first<<" "<<a[i].second<<endl;
      |                                       ^~~~
      |                                       std::endl
In file included from /usr/include/c++/9/iostream:39,
                 from foo.cc:1:
/usr/include/c++/9/ostream:599:5: note: 'std::endl' declared here
  599 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
自测
题目
P1041 OO10-2 基于vector的对象的排序
语言
C++
递交时间
2022-05-05 17:33:41
评测时间
2022-05-05 17:33:41
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes