Submission #1016488

#TimeUsernameProblemLanguageResultExecution timeMemory
1016488nisanduuParrots (IOI11_parrots)C++14
Compilation error
0 ms0 KiB
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> void decode(int N, int L, int X[]) { int i, b,n,digit,j,num; map<int,int> mp; string s,tmp; char d; for(i=0; i<L; i++) { b = X[i]; s = to_string(b); n = s.length(); d = s[n-1]; digit = (d - '0'); tmp = ""; for(j=0;j<n-1;j++){ tmp += s[j]; } num = stoi(tmp); mp[num] = digit; } for(auto z:mp){ output(z.second); } }

Compilation message (stderr)

encoder.cpp: In function 'void decode(int, int, int*)':
encoder.cpp:8:3: error: 'map' was not declared in this scope; did you mean 'std::map'?
    8 |   map<int,int> mp;
      |   ^~~
      |   std::map
In file included from /usr/include/c++/10/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from encoder.cpp:3:
/usr/include/c++/10/bits/stl_map.h:100:11: note: 'std::map' declared here
  100 |     class map
      |           ^~~
encoder.cpp:8:7: error: expected primary-expression before 'int'
    8 |   map<int,int> mp;
      |       ^~~
encoder.cpp:9:3: error: 'string' was not declared in this scope; did you mean 'std::string'?
    9 |   string s,tmp;
      |   ^~~~~~
      |   std::string
In file included from /usr/include/c++/10/iosfwd:39,
                 from /usr/include/c++/10/ios:38,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from encoder.cpp:3:
/usr/include/c++/10/bits/stringfwd.h:79:33: note: 'std::string' declared here
   79 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
encoder.cpp:13:5: error: 's' was not declared in this scope
   13 |     s = to_string(b);
      |     ^
encoder.cpp:13:9: error: 'to_string' was not declared in this scope; did you mean 'std::__cxx11::to_string'?
   13 |     s = to_string(b);
      |         ^~~~~~~~~
      |         std::__cxx11::to_string
In file included from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from encoder.cpp:3:
/usr/include/c++/10/bits/basic_string.h:6666:3: note: 'std::__cxx11::to_string' declared here
 6666 |   to_string(long double __val)
      |   ^~~~~~~~~
encoder.cpp:17:5: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   17 |     tmp = "";
      |     ^~~
      |     tm
encoder.cpp:21:11: error: 'stoi' was not declared in this scope; did you mean 'std::__cxx11::stoi'?
   21 |     num = stoi(tmp);
      |           ^~~~
      |           std::__cxx11::stoi
In file included from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from encoder.cpp:3:
/usr/include/c++/10/bits/basic_string.h:6677:3: note: 'std::__cxx11::stoi' declared here
 6677 |   stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~
encoder.cpp:22:5: error: 'mp' was not declared in this scope
   22 |     mp[num] = digit;
      |     ^~
encoder.cpp:24:14: error: 'mp' was not declared in this scope
   24 |   for(auto z:mp){
      |              ^~

/usr/bin/ld: /tmp/ccf2vvgZ.o: in function `main':
grader_decoder.cpp:(.text.startup+0x1ef): undefined reference to `decode(int, int, int*)'
collect2: error: ld returned 1 exit status