ログイン
新規登録
AtsuoCoder Waseda Tour Finals 2025
読込中…
Home
Tasks
Clar
Submissions
Standings
提出 ae85f882-cdb1-40f4-b608-bbf9ac87f993
コード
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; vector<int> A(0); while (q--) { int T, X; cin >> T; if (type == 1) { cin >> X; A.push_back(X) } else if (type == 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:13:13: error: 'type' was not declared in this scope; did you mean 'std::__cmp_cat::type'? 13 | if (type == 1) { | ^~~~ | std::__cmp_cat::type In file included from /usr/include/c++/13/bits/stl_pair.h:65, from /usr/include/c++/13/bits/stl_algobase.h:64, from /usr/include/c++/13/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51, from Main.cpp:1: /usr/include/c++/13/compare:49:11: note: 'std::__cmp_cat::type' declared here 49 | using type = signed char; | ^~~~ Main.cpp:15:26: error: expected ';' before '}' token 15 | A.push_back(X) | ^ | ; 16 | } else if (type == 2) { | ~ Main.cpp:18:34: error: expected ';' before '}' token 18 | A.insert(A.begin(), X) | ^ | ; 19 | }else{ | ~ Main.cpp:20:20: error: no matching function for call to 'std::vector<int>::erase(std::vector<int>::iterator, int&)' 20 | 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: /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) | ~~~~~~~~~~~~~~~^~~~~~