Submission #1016485

#TimeUsernameProblemLanguageResultExecution timeMemory
1016485nisanduuParrots (IOI11_parrots)C++14
Compilation error
0 ms0 KiB
#include "encoder.h"
#include "encoderlib.h"

void encode(int N, int M[])
{
  int i;
  for(i=0; i<N; i++)
    int num = i;
    string st = to_string(num);
    string s2 = to_string(M[i]);
    string f = st+s2;
    int number = stoi(f);
    
    send(number);
}
#include "decoder.h"
#include "decoderlib.h"

void decode(int N, int L, int X[])
{
  int i, b;
  map<int,int> mp;
  for(i=0; i<L; i++) {
    b = X[i];
    string s = to_string(b);
    int n = s.length();
    char d = s[n-1];
    int digit = (d - '0');
    string tmp = "";
    for(int j=0;j<n-1;j++){
            tmp += s[j];
    }
    int num = stoi(tmp);
    mp[num] = digit;
  }
  for(auto z:mp){
           output(z.second);
  }
}

Compilation message (stderr)

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:7:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
    7 |   for(i=0; i<N; i++)
      |   ^~~
encoder.cpp:9:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
    9 |     string st = to_string(num);
      |     ^~~~~~
encoder.cpp:8:9: warning: unused variable 'num' [-Wunused-variable]
    8 |     int num = i;
      |         ^~~
encoder.cpp:9:5: error: 'string' was not declared in this scope
    9 |     string st = to_string(num);
      |     ^~~~~~
encoder.cpp:10:11: error: expected ';' before 's2'
   10 |     string s2 = to_string(M[i]);
      |           ^~~
      |           ;
encoder.cpp:11:11: error: expected ';' before 'f'
   11 |     string f = st+s2;
      |           ^~
      |           ;
encoder.cpp:12:23: error: 'f' was not declared in this scope
   12 |     int number = stoi(f);
      |                       ^
encoder.cpp:12:18: error: 'stoi' was not declared in this scope
   12 |     int number = stoi(f);
      |                  ^~~~

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:7:3: error: 'map' was not declared in this scope
    7 |   map<int,int> mp;
      |   ^~~
decoder.cpp:7:7: error: expected primary-expression before 'int'
    7 |   map<int,int> mp;
      |       ^~~
decoder.cpp:10:5: error: 'string' was not declared in this scope
   10 |     string s = to_string(b);
      |     ^~~~~~
decoder.cpp:11:13: error: 's' was not declared in this scope
   11 |     int n = s.length();
      |             ^
decoder.cpp:14:11: error: expected ';' before 'tmp'
   14 |     string tmp = "";
      |           ^~~~
      |           ;
decoder.cpp:16:13: error: 'tmp' was not declared in this scope
   16 |             tmp += s[j];
      |             ^~~
decoder.cpp:18:20: error: 'tmp' was not declared in this scope
   18 |     int num = stoi(tmp);
      |                    ^~~
decoder.cpp:18:15: error: 'stoi' was not declared in this scope
   18 |     int num = stoi(tmp);
      |               ^~~~
decoder.cpp:19:5: error: 'mp' was not declared in this scope
   19 |     mp[num] = digit;
      |     ^~
decoder.cpp:21:14: error: 'mp' was not declared in this scope
   21 |   for(auto z:mp){
      |              ^~