Submission #467109

#TimeUsernameProblemLanguageResultExecution timeMemory
467109a_aguiloMemory (IOI10_memory)C++14
Compilation error
0 ms0 KiB
#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:7:24: error: no matching function for call to 'std::map<char, int>::map(int)'
    7 |   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:1:
/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:7:24: note:   candidate expects 4 arguments, 1 provided
    7 |   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:1:
/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:7:24: note:   candidate expects 2 arguments, 1 provided
    7 |   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:1:
/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:7:24: note:   candidate expects 3 arguments, 1 provided
    7 |   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:1:
/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:13:16: error: 'faceup' was not declared in this scope
   13 |       char c = faceup (i);
      |                ^~~~~~
memory.cpp:22:13: error: expected unqualified-id before 'new'
   22 |        char new = faceup (i);
      |             ^~~
memory.cpp:23:16: error: expected type-specifier before '==' token
   23 |        if (new == c){
      |                ^~