# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
119825 | 2019-06-22T13:07:14 Z | dolphingarlic | Crayfish scrivener (IOI12_scrivener) | C++14 | Compilation error |
0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; pair<char, char> v[1000001]; string s, t; int indx = 0; bool got = false; void Init() { } void TypeLetter(char L) { v[indx++] = {'T', L}; } void UndoCommands(int U) { v[indx++] = {'U', (char)U}; } char GetLetter(int P) { if (!got) { get(); got = true; } return t[P]; } void get() { int ptr = indx - 1; while (ptr != -1) { while (ptr != -1 && v[ptr].first == 'U') ptr -= (int)v[ptr].second + 1; s += v[ptr--].second; } for (int i = 0; i < s.size(); i++) t[i] = s[s.size() - 1 - i]; } // int main() { // int t; // cin >> t; // for (int i = 0; i < t; i++) { // char c, d; int e; // cin >> c; // switch (c) { // case 'T': // cin >> d; // TypeLetter(d); // break; // case 'P': // cin >> e; // cout << GetLetter(e) << '\n'; // break; // default: // cin >> e; // UndoCommands(e); // } // } // }
Compilation message
scrivener.cpp: In function 'char GetLetter(int)': scrivener.cpp:23:15: error: no matching function for call to 'get()' get(); ^ In file included from /usr/include/c++/7/algorithm:60:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65, from scrivener.cpp:2: /usr/include/c++/7/utility:229:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(std::pair<_Tp1, _Tp2>&) get(std::pair<_Tp1, _Tp2>& __in) noexcept ^~~ /usr/include/c++/7/utility:229:5: note: template argument deduction/substitution failed: scrivener.cpp:23:15: note: candidate expects 1 argument, 0 provided get(); ^ In file included from /usr/include/c++/7/algorithm:60:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65, from scrivener.cpp:2: /usr/include/c++/7/utility:234:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(std::pair<_Tp1, _Tp2>&&) get(std::pair<_Tp1, _Tp2>&& __in) noexcept ^~~ /usr/include/c++/7/utility:234:5: note: template argument deduction/substitution failed: scrivener.cpp:23:15: note: candidate expects 1 argument, 0 provided get(); ^ In file included from /usr/include/c++/7/algorithm:60:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65, from scrivener.cpp:2: /usr/include/c++/7/utility:239:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const std::pair<_Tp1, _Tp2>&) get(const std::pair<_Tp1, _Tp2>& __in) noexcept ^~~ /usr/include/c++/7/utility:239:5: note: template argument deduction/substitution failed: scrivener.cpp:23:15: note: candidate expects 1 argument, 0 provided get(); ^ In file included from /usr/include/c++/7/algorithm:60:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65, from scrivener.cpp:2: /usr/include/c++/7/utility:248:5: note: candidate: template<class _Tp, class _Up> constexpr _Tp& std::get(std::pair<_T1, _T2>&) get(pair<_Tp, _Up>& __p) noexcept ^~~ /usr/include/c++/7/utility:248:5: note: template argument deduction/substitution failed: scrivener.cpp:23:15: note: candidate expects 1 argument, 0 provided get(); ^ In file included from /usr/include/c++/7/algorithm:60:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65, from scrivener.cpp:2: /usr/include/c++/7/utility:253:5: note: candidate: template<class _Tp, class _Up> constexpr const _Tp& std::get(const std::pair<_T1, _T2>&) get(const pair<_Tp, _Up>& __p) noexcept ^~~ /usr/include/c++/7/utility:253:5: note: template argument deduction/substitution failed: scrivener.cpp:23:15: note: candidate expects 1 argument, 0 provided get(); ^ In file included from /usr/include/c++/7/algorithm:60:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65, from scrivener.cpp:2: /usr/include/c++/7/utility:258:5: note: candidate: template<class _Tp, class _Up> constexpr _Tp&& std::get(std::pair<_T1, _T2>&&) get(pair<_Tp, _Up>&& __p) noexcept ^~~ /usr/include/c++/7/utility:258:5: note: template argument deduction/substitution failed: scrivener.cpp:23:15: note: candidate expects 1 argument, 0 provided get(); ^ In file included from /usr/include/c++/7/algorithm:60:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65, from scrivener.cpp:2: /usr/include/c++/7/utility:263:5: note: candidate: template<class _Tp, class _Up> constexpr _Tp& std::get(std::pair<_Up, _Tp>&) get(pair<_Up, _Tp>& __p) noexcept ^~~ /usr/include/c++/7/utility:263:5: note: template argument deduction/substitution failed: scrivener.cpp:23:15: note: candidate expects 1 argument, 0 provided get(); ^ In file included from /usr/include/c++/7/algorithm:60:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65, from scrivener.cpp:2: /usr/include/c++/7/utility:268:5: note: candidate: template<class _Tp, class _Up> constexpr const _Tp& std::get(const std::pair<_Up, _Tp>&) get(const pair<_Up, _Tp>& __p) noexcept ^~~ /usr/include/c++/7/utility:268:5: note: template argument deduction/substitution failed: scrivener.cpp:23:15: note: candidate expects 1 argument, 0 provided get(); ^ In file included from /usr/include/c++/7/algorithm:60:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65, from scrivener.cpp:2: /usr/include/c++/7/utility:273:5: note: candidate: template<class _Tp, class _Up> constexpr _Tp&& std::get(std::pair<_Up, _Tp>&&) get(pair<_Up, _Tp>&& __p) noexcept ^~~ /usr/include/c++/7/utility:273:5: note: template argument deduction/substitution failed: scrivener.cpp:23:15: note: candidate expects 1 argument, 0 provided get(); ^ In file included from /usr/include/c++/7/tuple:39:0, from /usr/include/c++/7/functional:54, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71, from scrivener.cpp:2: /usr/include/c++/7/array:307:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp& std::get(std::array<_Tp, _Nm>&) get(array<_Tp, _Nm>& __arr) noexcept ^~~ /usr/include/c++/7/array:307:5: note: template argument deduction/substitution failed: scrivener.cpp:23:15: note: candidate expects 1 argument, 0 provided get(); ^ In file included from /usr/include/c++/7/tuple:39:0, from /usr/include/c++/7/functional:54, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71, from scrivener.cpp:2: /usr/include/c++/7/array:316:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp&& std::get(std::array<_Tp, _Nm>&&) get(array<_Tp, _Nm>&& __arr) noexcept ^~~ /usr/include/c++/7/array:316:5: note: template argument deduction/substitution failed: scrivener.cpp:23:15: note: candidate expects 1 argument, 0 provided get(); ^ In file included from /usr/include/c++/7/tuple:39:0, from /usr/include/c++/7/functional:54, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71, from scrivener.cpp:2: /usr/include/c++/7/array:324:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const std::array<_Tp, _Nm>&) get(const array<_Tp, _Nm>& __arr) noexcept ^~~ /usr/include/c++/7/array:324:5: note: template argument deduction/substitution failed: scrivener.cpp:23:15: note: candidate expects 1 argument, 0 provided get(); ^ In file included from /usr/include/c++/7/functional:54:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71, from scrivener.cpp:2: /usr/include/c++/7/tuple:1314:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(std::tuple<_Elements ...>&) get(tuple<_Elements...>& __t) noexcept ^~~ /usr/include/c++/7/tuple:1314:5: note: template argument deduction/substitution failed: scrivener.cpp:23:15: note: candidate expects 1 argument, 0 provided get(); ^ In file included from /usr/include/c++/7/functional:54:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71, from scrivener.cpp:2: /usr/include/c++/7/tuple:1320:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(const std::tuple<_Elements ...>&) get(const tuple<_Elements...>& __t) noexcept ^~~ /usr/include/c++/7/tuple:1320:5: note: template argument deduction/substitution failed: scrivener.cpp:23:15: note: candidate expects 1 argument, 0 provided get(); ^ In file included from /usr/include/c++/7/functional:54:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71, from scrivener.cpp:2: /usr/include/c++/7/tuple:1326:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(std::tuple<_Elements ...>&&) get(tuple<_Elements...>&& __t) noexcept ^~~ /usr/include/c++/7/tuple:1326:5: note: template argument deduction/substitution failed: scrivener.cpp:23:15: note: candidate expects 1 argument, 0 provided get(); ^ In file included from /usr/include/c++/7/functional:54:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71, from scrivener.cpp:2: /usr/include/c++/7/tuple:1349:5: note: candidate: template<class _Tp, class ... _Types> constexpr _Tp& std::get(std::tuple<_Elements ...>&) get(tuple<_Types...>& __t) noexcept ^~~ /usr/include/c++/7/tuple:1349:5: note: template argument deduction/substitution failed: scrivener.cpp:23:15: note: candidate expects 1 argument, 0 provided get(); ^ In file included from /usr/include/c++/7/functional:54:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71, from scrivener.cpp:2: /usr/include/c++/7/tuple:1355:5: note: candidate: template<class _Tp, class ... _Types> constexpr _Tp&& std::get(std::tuple<_Elements ...>&&) get(tuple<_Types...>&& __t) noexcept ^~~ /usr/include/c++/7/tuple:1355:5: note: template argument deduction/substitution failed: scrivener.cpp:23:15: note: candidate expects 1 argument, 0 provided get(); ^ In file included from /usr/include/c++/7/functional:54:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71, from scrivener.cpp:2: /usr/include/c++/7/tuple:1361:5: note: candidate: template<class _Tp, class ... _Types> constexpr const _Tp& std::get(const std::tuple<_Elements ...>&) get(const tuple<_Types...>& __t) noexcept ^~~ /usr/include/c++/7/tuple:1361:5: note: template argument deduction/substitution failed: scrivener.cpp:23:15: note: candidate expects 1 argument, 0 provided get(); ^ scrivener.cpp: In function 'void get()': scrivener.cpp:35:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < s.size(); i++) t[i] = s[s.size() - 1 - i]; ~~^~~~~~~~~~