ログイン
新規登録
AtsuoCoder Petrozavodsk Contest 001
読込中…
Home
Tasks
Clar
Submissions
Standings
提出 925aef8f-308c-4334-b3ba-aa4cc589054f
コード
#include <bits/stdc++.h> using namespace std; int main() { vector<int> S; int Q,X,T; cin>>Q; for(int i=0;i<Q;i++){ cin>>T; if(T==1)cin>>X; if(T==1){ *S.end() = X; } else if(T==2){ cout<<S.at(0)<<endl; S.erase(S.at(0)); } else if(T==3){ cout<<S.size()<<endl; } } }
結果
問題
点数
言語
結果
実行時間
メモリ
E - Q
0
C++
WJ
0 ms
0 KiB
コンパイルエラー
Main.cpp: In function 'int main()': Main.cpp:17:20: error: no matching function for call to 'std::vector<int>::erase(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)' 17 | S.erase(S.at(0)); | ~~~~~~~^~~~~~~~~ In file included from /usr/include/c++/13/vector:66, from /usr/include/c++/13/functional:64, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53, from Main.cpp:1: /usr/include/c++/13/bits/stl_vector.h:1534:7: note: candidate: 'constexpr std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]' 1534 | erase(const_iterator __position) | ^~~~~ /usr/include/c++/13/bits/stl_vector.h:1534:28: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'std::vector<int>::const_iterator' 1534 | erase(const_iterator __position) | ~~~~~~~~~~~~~~~^~~~~~~~~~ /usr/include/c++/13/bits/stl_vector.h:1562:7: note: candidate: 'constexpr std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]' 1562 | erase(const_iterator __first, const_iterator __last) | ^~~~~ /usr/include/c++/13/bits/stl_vector.h:1562:7: note: candidate expects 2 arguments, 1 provided