ログイン
新規登録
AtsuoCoder Waseda Tour Finals 2025
読込中…
Home
Tasks
Clar
Submissions
Standings
提出 d5be2e28-3a9f-4e53-929c-046d5420e642
コード
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; vector<int> A(0); while (q--) { int T, X; cin >> T; for(int i = 0; i<q; i++){ if (T == 1) { cin >> X; A.push_back(X); } else if (T == 2) { cin >> X; A.insert(A.begin(), X); }else{ A.erase(A.begin(),X); cout << A.at(0); } } }
結果
問題
点数
言語
結果
実行時間
メモリ
E - Q2
0
C++
WJ
0 ms
0 KiB
コンパイルエラー
Main.cpp: In function 'int main()': Main.cpp:21:20: error: no matching function for call to 'std::vector<int>::erase(std::vector<int>::iterator, int&)' 21 | A.erase(A.begin(),X); | ~~~~~~~^~~~~~~~~~~~~ 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:7: note: candidate expects 1 argument, 2 provided /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:52: note: no known conversion for argument 2 from 'int' to 'std::vector<int>::const_iterator' 1562 | erase(const_iterator __first, const_iterator __last) | ~~~~~~~~~~~~~~~^~~~~~ Main.cpp:26:6: error: expected '}' at end of input 26 | } | ^ Main.cpp:4:12: note: to match this '{' 4 | int main() { | ^