Submission #341793

#TimeUsernameProblemLanguageResultExecution timeMemory
341793marvenleeMemory (IOI10_memory)C++14
Compilation error
0 ms0 KiB
#include "grader.h" #include "memory.h" #include <map> using namespace std; void play() { int i; char a, b; map<char,int> mp; for (i=1; i<=50; i++){ a = faceup(i); if(mp.find(a)!=mp.end()){ b = faceup(mp.find(a)); } else { mp[a]=i; i+=1; b= faceup(i); mp[b]=i; } } }

Compilation message (stderr)

memory.cpp: In function 'void play()':
memory.cpp:14:31: error: cannot convert 'std::map<char, int>::iterator' {aka 'std::_Rb_tree_iterator<std::pair<const char, int> >'} to 'int'
   14 |             b = faceup(mp.find(a));
      |                        ~~~~~~~^~~
      |                               |
      |                               std::map<char, int>::iterator {aka std::_Rb_tree_iterator<std::pair<const char, int> >}
In file included from memory.cpp:1:
grader.h:1:17: note:   initializing argument 1 of 'char faceup(int)'
    1 | char faceup(int C);
      |             ~~~~^