Submission #468440

#TimeUsernameProblemLanguageResultExecution timeMemory
468440a_aguiloMemory (IOI10_memory)C++14
Compilation error
0 ms0 KiB
#include "grader.h" #include "memory.h" #include <bits/stdc++.h> using namespace std; void play() { int candies = 0; map <char, int> M (50); set <int> asked; set <char> received; while (candies < 25){ int i = 1; while (i <= 25){ char c = faceup (i); if (received.find(c) != received.end()){ faceup (M[c]); candies ++; } else{ received.insert(c); M[c] = i; ++i; char new = faceup (i); if (new == c){ candies ++; } else { i--; } } ++i; } } }

Compilation message (stderr)

memory.cpp: In function 'void play()':
memory.cpp:10:26: error: no matching function for call to 'std::map<char, int>::map(int)'
   10 |     map <char, int> M (50);
      |                          ^
In file included from /usr/include/c++/10/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from memory.cpp:3:
/usr/include/c++/10/bits/stl_map.h:290:2: note: candidate: 'template<class _InputIterator> std::map<_Key, _Tp, _Compare, _Alloc>::map(_InputIterator, _InputIterator, const _Compare&, const allocator_type&) [with _InputIterator = _InputIterator; _Key = char; _Tp = int; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, int> >]'
  290 |  map(_InputIterator __first, _InputIterator __last,
      |  ^~~
/usr/include/c++/10/bits/stl_map.h:290:2: note:   template argument deduction/substitution failed:
memory.cpp:10:26: note:   candidate expects 4 arguments, 1 provided
   10 |     map <char, int> M (50);
      |                          ^
In file included from /usr/include/c++/10/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from memory.cpp:3:
/usr/include/c++/10/bits/stl_map.h:273:2: note: candidate: 'template<class _InputIterator> std::map<_Key, _Tp, _Compare, _Alloc>::map(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = char; _Tp = int; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, int> >]'
  273 |  map(_InputIterator __first, _InputIterator __last)
      |  ^~~
/usr/include/c++/10/bits/stl_map.h:273:2: note:   template argument deduction/substitution failed:
memory.cpp:10:26: note:   candidate expects 2 arguments, 1 provided
   10 |     map <char, int> M (50);
      |                          ^
In file included from /usr/include/c++/10/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from memory.cpp:3:
/usr/include/c++/10/bits/stl_map.h:256:2: note: candidate: 'template<class _InputIterator> std::map<_Key, _Tp, _Compare, _Alloc>::map(_InputIterator, _InputIterator, const allocator_type&) [with _InputIterator = _InputIterator; _Key = char; _Tp = int; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, int> >]'
  256 |  map(_InputIterator __first, _InputIterator __last,
      |  ^~~
/usr/include/c++/10/bits/stl_map.h:256:2: note:   template argument deduction/substitution failed:
memory.cpp:10:26: note:   candidate expects 3 arguments, 1 provided
   10 |     map <char, int> M (50);
      |                          ^
In file included from /usr/include/c++/10/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from memory.cpp:3:
/usr/include/c++/10/bits/stl_map.h:250:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(std::initializer_list<std::pair<const _Key, _Tp> >, const allocator_type&) [with _Key = char; _Tp = int; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::allocator_type = std::allocator<std::pair<const char, int> >]'
  250 |       map(initializer_list<value_type> __l, const allocator_type& __a)
      |       ^~~
/usr/include/c++/10/bits/stl_map.h:250:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/10/bits/stl_map.h:244:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(std::map<_Key, _Tp, _Compare, _Alloc>&&, const allocator_type&) [with _Key = char; _Tp = int; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::allocator_type = std::allocator<std::pair<const char, int> >]'
  244 |       map(map&& __m, const allocator_type& __a)
      |       ^~~
/usr/include/c++/10/bits/stl_map.h:244:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/10/bits/stl_map.h:240:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(const std::map<_Key, _Tp, _Compare, _Alloc>&, const allocator_type&) [with _Key = char; _Tp = int; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::allocator_type = std::allocator<std::pair<const char, int> >]'
  240 |       map(const map& __m, const allocator_type& __a)
      |       ^~~
/usr/include/c++/10/bits/stl_map.h:240:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/10/bits/stl_map.h:236:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(const allocator_type&) [with _Key = char; _Tp = int; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::allocator_type = std::allocator<std::pair<const char, int> >]'
  236 |       map(const allocator_type& __a)
      |       ^~~
/usr/include/c++/10/bits/stl_map.h:236:33: note:   no known conversion for argument 1 from 'int' to 'const allocator_type&' {aka 'const std::allocator<std::pair<const char, int> >&'}
  236 |       map(const allocator_type& __a)
      |           ~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_map.h:228:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(std::initializer_list<std::pair<const _Key, _Tp> >, const _Compare&, const allocator_type&) [with _Key = char; _Tp = int; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::allocator_type = std::allocator<std::pair<const char, int> >]'
  228 |       map(initializer_list<value_type> __l,
      |       ^~~
/usr/include/c++/10/bits/stl_map.h:228:40: note:   no known conversion for argument 1 from 'int' to 'std::initializer_list<std::pair<const char, int> >'
  228 |       map(initializer_list<value_type> __l,
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_map.h:215:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(std::map<_Key, _Tp, _Compare, _Alloc>&&) [with _Key = char; _Tp = int; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, int> >]'
  215 |       map(map&&) = default;
      |       ^~~
/usr/include/c++/10/bits/stl_map.h:215:11: note:   no known conversion for argument 1 from 'int' to 'std::map<char, int>&&'
  215 |       map(map&&) = default;
      |           ^~~~~
/usr/include/c++/10/bits/stl_map.h:207:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(const std::map<_Key, _Tp, _Compare, _Alloc>&) [with _Key = char; _Tp = int; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, int> >]'
  207 |       map(const map&) = default;
      |       ^~~
/usr/include/c++/10/bits/stl_map.h:207:11: note:   no known conversion for argument 1 from 'int' to 'const std::map<char, int>&'
  207 |       map(const map&) = default;
      |           ^~~~~~~~~~
/usr/include/c++/10/bits/stl_map.h:194:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(const _Compare&, const allocator_type&) [with _Key = char; _Tp = int; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::allocator_type = std::allocator<std::pair<const char, int> >]'
  194 |       map(const _Compare& __comp,
      |       ^~~
/usr/include/c++/10/bits/stl_map.h:194:27: note:   no known conversion for argument 1 from 'int' to 'const std::less<char>&'
  194 |       map(const _Compare& __comp,
      |           ~~~~~~~~~~~~~~~~^~~~~~
/usr/include/c++/10/bits/stl_map.h:185:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map() [with _Key = char; _Tp = int; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, int> >]'
  185 |       map() = default;
      |       ^~~
/usr/include/c++/10/bits/stl_map.h:185:7: note:   candidate expects 0 arguments, 1 provided
memory.cpp:25:22: error: expected unqualified-id before 'new'
   25 |                 char new = faceup (i);
      |                      ^~~
memory.cpp:26:25: error: expected type-specifier before '==' token
   26 |                 if (new == c){
      |                         ^~