ログイン
新規登録
AtsuoCoder Petrozavodsk Contest 001
読込中…
Home
Tasks
Clar
Submissions
Standings
提出 388e2cc4-0015-4bd6-bea8-864ecb3fcbbf
コード
#include <bits/stdc++.h> #include <vector> using namespace std; int main() { int Q; cin >> Q; vector<int> A(); vector<int> T(Q); for(int i = 0;i < Q;i++) { cin >> T.at(i); if(T.at(i) == 1) { int x; cin >> x; A.at(A.size()-1) = x; } else if(T.at(i) == 2) { cout << A.at(0) << endl; A.erase(vec.begin); } else if(T.at(i) == 3) { cout << A.size() << endl; } } }
結果
問題
点数
言語
結果
実行時間
メモリ
E - Q
0
C++
WJ
0 ms
0 KiB
コンパイルエラー
Main.cpp: In function 'int main()': Main.cpp:9:16: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 9 | vector<int> A(); | ^~ Main.cpp:9:16: note: remove parentheses to default-initialize a variable 9 | vector<int> A(); | ^~ | -- Main.cpp:20:9: error: request for member 'at' in 'A', which is of non-class type 'std::vector<int>()' 20 | A.at(A.size()-1) = x; | ^~ Main.cpp:20:14: error: request for member 'size' in 'A', which is of non-class type 'std::vector<int>()' 20 | A.at(A.size()-1) = x; | ^~~~ Main.cpp:24:17: error: request for member 'at' in 'A', which is of non-class type 'std::vector<int>()' 24 | cout << A.at(0) << endl; | ^~ Main.cpp:25:9: error: request for member 'erase' in 'A', which is of non-class type 'std::vector<int>()' 25 | A.erase(vec.begin); | ^~~~~ Main.cpp:25:15: error: 'vec' was not declared in this scope 25 | A.erase(vec.begin); | ^~~ Main.cpp:29:17: error: request for member 'size' in 'A', which is of non-class type 'std::vector<int>()' 29 | cout << A.size() << endl; | ^~~~