Submission #1297935

#TimeUsernameProblemLanguageResultExecution timeMemory
1297935alexiahParrots (IOI11_parrots)C++20
Compilation error
0 ms0 KiB
#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
using namespace std;

void encode(int n, int m[])
{
  vector<string> enc(n+1);
  for(int i = 1; i <= n; i++){
    enc[i].push_back(i); enc[i].push_back(0); enc.push_back(0); enc[i].push_back(m[i]);
  }
  for(int i = 1; i <= n; i++){
    int x = stoi(enc[i]);
    send(x);
  }
  return;
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;

void decode(int n, int l, int X[])
{
  vector<int> ans;
  vector<int> aux
  for(auto x : X){
    aux.push_back(x);
  }
  sort(aux.begin() , aux.end());
  for(int i = 0; i < l; i++){
    string act = to_string(X[i]);
    for(int i = 0; i < act.size(); i++){
      if(act[i] == 0){
        string ns;
        for(int j = i+2; j < act.size(); j++){
          ns.push_back(act[j]);
        }
        int v = stoi(ns);
        ans.push_back(v);
        break;
      }
    }
  }
  for(auto x : ans){
    output(x);
  }
  return;
}

Compilation message (stderr)

# 2번째 컴파일 단계

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:10:3: error: expected initializer before 'for'
   10 |   for(auto x : X){
      |   ^~~
decoder.cpp:13:8: error: 'aux' was not declared in this scope
   13 |   sort(aux.begin() , aux.end());
      |        ^~~