ログイン
新規登録
AtsuoCoder Waseda Tour Finals 2025
読込中…
Home
Tasks
Clar
Submissions
Standings
提出 ff8302a0-99a5-457a-ad18-75838df099a2
コード
#include <bits/stdc++.h> using namespace std; int main() { queue<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.push(X); } else if(T==2)cin>>X; else if(T==2){ auto it = std::cbegin(S); // 0 を指すイテレータ // 1 を指すようになる v.insert(it, S); } else if(T==3){ cout<<S.front()<<endl; S.pop(); } } }
結果
問題
点数
言語
結果
実行時間
メモリ
E - Q2
0
C++
WJ
0 ms
0 KiB
コンパイルエラー
Main.cpp: In function 'int main()': Main.cpp:18:34: error: no matching function for call to 'cbegin(std::queue<int>&)' 18 | auto it = std::cbegin(S); // 0 を指すイテレータ | ~~~~~~~~~~~^~~ In file included from /usr/include/c++/13/string:53, from /usr/include/c++/13/bitset:52, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52, from Main.cpp:1: /usr/include/c++/13/bits/range_access.h:126:5: note: candidate: 'template<class _Container> constexpr decltype (std::begin(__cont)) std::cbegin(const _Container&)' 126 | cbegin(const _Container& __cont) noexcept(noexcept(std::begin(__cont))) | ^~~~~~ /usr/include/c++/13/bits/range_access.h:126:5: note: template argument deduction/substitution failed: /usr/include/c++/13/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (std::begin(__cont)) std::cbegin(const _Container&) [with _Container = std::queue<int>]': Main.cpp:18:34: required from here /usr/include/c++/13/bits/range_access.h:127:29: error: no matching function for call to 'begin(const std::queue<int>&)' 127 | -> decltype(std::begin(__cont)) | ~~~~~~~~~~^~~~~~~~ In file included from /usr/include/c++/13/bits/algorithmfwd.h:39, from /usr/include/c++/13/bits/stl_algo.h:59, from /usr/include/c++/13/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51: /usr/include/c++/13/initializer_list:88:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::begin(initializer_list<_Tp>)' 88 | begin(initializer_list<_Tp> __ils) noexcept | ^~~~~ /usr/include/c++/13/initializer_list:88:5: note: template argument deduction/substitution failed: /usr/include/c++/13/bits/range_access.h:127:29: note: 'std::queue<int>' is not derived from 'std::initializer_list<_Tp>' 127 | -> decltype(std::begin(__cont)) | ~~~~~~~~~~^~~~~~~~ /usr/include/c++/13/bits/range_access.h:52:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(_Container&)' 52 | begin(_Container& __cont) -> decltype(__cont.begin()) | ^~~~~ /usr/include/c++/13/bits/range_access.h:52:5: note: template argument deduction/substitution failed: /usr/include/c++/13/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(_Container&) [with _Container = const std::queue<int>]': /usr/include/c++/13/bits/range_access.h:127:29: required by substitution of 'template<class _Container> constexpr decltype (std::begin(__cont)) std::cbegin(const _Container&) [with _Container = std::queue<int>]' Main.cpp:18:34: required from here /usr/include/c++/13/bits/range_access.h:52:50: error: 'const class std::queue<int>' has no member named 'begin' 52 | begin(_Container& __cont) -> decltype(__cont.begin()) | ~~~~~~~^~~~~ /usr/include/c++/13/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (std::begin(__cont)) std::cbegin(const _Container&) [with _Container = std::queue<int>]': Main.cpp:18:34: required from here /usr/include/c++/13/bits/range_access.h:63:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(const _Container&)' 63 | begin(const _Container& __cont) -> decltype(__cont.begin()) | ^~~~~ /usr/include/c++/13/bits/range_access.h:63:5: note: template argument deduction/substitution failed: /usr/include/c++/13/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(const _Container&) [with _Container = std::queue<int>]': /usr/include/c++/13/bits/range_access.h:127:29: required by substitution of 'template<class _Container> constexpr decltype (std::begin(__cont)) std::cbegin(const _Container&) [with _Container = std::queue<int>]' Main.cpp:18:34: required from here /usr/include/c++/13/bits/range_access.h:63:56: error: 'const class std::queue<int>' has no member named 'begin' 63 | begin(const _Container& __cont) -> decltype(__cont.begin()) | ~~~~~~~^~~~~ /usr/include/c++/13/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (std::begin(__cont)) std::cbegin(const _Container&) [with _Container = std::queue<int>]': Main.cpp:18:34: required from here /usr/include/c++/13/bits/range_access.h:95:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::begin(_Tp (&)[_Nm])' 95 | begin(_Tp (&__arr)[_Nm]) noexcept | ^~~~~ /usr/include/c++/13/bits/range_access.h:95:5: note: template argument deduction/substitution failed: /usr/include/c++/13/bits/range_access.h:127:29: note: mismatched types '_Tp [_Nm]' and 'const std::queue<int>' 127 | -> decltype(std::begin(__cont)) | ~~~~~~~~~~^~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:166: /usr/include/c++/13/valarray:1227:5: note: candidate: 'template<class _Tp> _Tp* std::begin(valarray<_Tp>&)' 1227 | begin(valarray<_Tp>& __va) noexcept | ^~~~~ /usr/include/c++/13/valarray:1227:5: note: template argument deduction/substitution failed: /usr/include/c++/13/bits/range_access.h:127:29: note: types 'std::valarray<_Tp>' and 'const std::queue<int>' have incompatible cv-qualifiers 127 | -> decltype(std::begin(__cont)) | ~~~~~~~~~~^~~~~~~~ /usr/include/c++/13/valarray:1238:5: note: candidate: 'template<class _Tp> const _Tp* std::begin(const valarray<_Tp>&)' 1238 | begin(const valarray<_Tp>& __va) noexcept | ^~~~~ /usr/include/c++/13/valarray:1238:5: note: template argument deduction/substitution failed: /usr/include/c++/13/bits/range_access.h:127:29: note: 'const std::queue<int>' is not derived from 'const std::valarray<_Tp>' 127 | -> decltype(std::begin(__cont)) | ~~~~~~~~~~^~~~~~~~ Main.cpp:20:5: error: 'v' was not declared in this scope 20 | v.insert(it, S); | ^