Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
127114 张永良 18成绩插入 C++ Compile Error 0 MS 0 KB 275 2025-07-24 12:57:17

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main() { int n,m; cin>>n; vector<int>a; for(int i=0;i<=n-1;i++){ cin>>m; a.push_back(m); } int c; cin>>c; a.insert(a.begin(1).c); for(int i=1;i<=a.size();i++) cout<<a[i]; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:14:20: error: no matching function for call to 'std::vector::begin(int)'
  a.insert(a.begin(1).c);
                    ^
In file included from /usr/include/c++/5/vector:64:0,
                 from /usr/include/c++/5/bits/random.h:34,
                 from /usr/include/c++/5/random:49,
                 from /usr/include/c++/5/bits/stl_algo.h:66,
                 from /usr/include/c++/5/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64,
                 from Main.cc:1:
/usr/include/c++/5/bits/stl_vector.h:547:7: note: candidate: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::begin() [with _Tp = int; _Alloc = std::allocator; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator >; typename std::_Vector_base<_Tp, _Alloc>::pointer = int*]
       begin() _GLIBCXX_NOEXCEPT
       ^
/usr/include/c++/5/bits/stl_vector.h:547:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/5/bits/stl_vector.h:556:7: note: candidate: std::vector<_Tp, _Alloc>::const_iterator std::vector<_Tp, _Alloc>::begin() const [with _Tp = int; _Alloc = std::allocator; std::vector<_Tp, _Alloc>::const_iterator = __gnu_cxx::__normal_iterator >; typename __gnu_cxx::__alloc_traits::_Tp_alloc_type>::const_pointer = const int*]
       begin() const _GLIBCXX_NOEXCEPT
       ^
/usr/include/c++/5/bits/stl_vector.h:556:7: note:   candidate expects 0 arguments, 1 provided
Main.cc:15:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=1;i<=a.size();i++)
               ^
Main.cc: At global scope:
Main.cc:18:2: error: expected unqualified-id before 'return'
  return 0;
  ^
Main.cc:19:1: error: expected declaration before '}' token
 }
 ^