Submission #1297932

#TimeUsernameProblemLanguageResultExecution timeMemory
1297932alexiahParrots (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>

void decode(int n, int l, int X[])
{
  vector<int> ans;
  vector<int> aux = 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:7:3: error: 'vector' was not declared in this scope
    7 |   vector<int> ans;
      |   ^~~~~~
decoder.cpp:7:3: note: suggested alternatives:
In file included from /usr/include/c++/13/vector:66,
                 from /usr/include/c++/13/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53,
                 from decoder.cpp:3:
/usr/include/c++/13/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/13/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
decoder.cpp:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> ans;
      |          ^~~
decoder.cpp:8:10: error: expected primary-expression before 'int'
    8 |   vector<int> aux = X;
      |          ^~~
decoder.cpp:9:8: error: 'aux' was not declared in this scope
    9 |   sort(aux.begin() , aux.end());
      |        ^~~
decoder.cpp:9:3: error: 'sort' was not declared in this scope
    9 |   sort(aux.begin() , aux.end());
      |   ^~~~
decoder.cpp:9:3: note: suggested alternatives:
In file included from /usr/include/c++/13/algorithm:73,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51:
/usr/include/c++/13/pstl/glue_algorithm_defs.h:296:1: note:   'std::sort'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
In file included from /usr/include/c++/13/algorithm:63:
/usr/include/c++/13/bits/ranges_algo.h:1801:30: note:   'std::ranges::sort'
 1801 |   inline constexpr __sort_fn sort{};
      |                              ^~~~
decoder.cpp:11:5: error: 'string' was not declared in this scope
   11 |     string act = to_string(X[i]);
      |     ^~~~~~
decoder.cpp:11:5: note: suggested alternatives:
In file included from /usr/include/c++/13/string:41,
                 from /usr/include/c++/13/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52:
/usr/include/c++/13/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/13/string:66:11: note:   'std::pmr::string'
   66 |     using string    = basic_string<char>;
      |           ^~~~~~
decoder.cpp:12:24: error: 'act' was not declared in this scope; did you mean 'acct'?
   12 |     for(int i = 0; i < act.size(); i++){
      |                        ^~~
      |                        acct
decoder.cpp:14:15: error: expected ';' before 'ns'
   14 |         string ns;
      |               ^~~
      |               ;
decoder.cpp:16:11: error: 'ns' was not declared in this scope; did you mean 'n'?
   16 |           ns.push_back(act[j]);
      |           ^~
      |           n
decoder.cpp:18:22: error: 'ns' was not declared in this scope; did you mean 'n'?
   18 |         int v = stoi(ns);
      |                      ^~
      |                      n
decoder.cpp:18:17: error: 'stoi' was not declared in this scope; did you mean 'std::__cxx11::stoi'?
   18 |         int v = stoi(ns);
      |                 ^~~~
      |                 std::__cxx11::stoi
In file included from /usr/include/c++/13/string:54:
/usr/include/c++/13/bits/basic_string.h:4272:3: note: 'std::__cxx11::stoi' declared here
 4272 |   stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~
decoder.cpp:19:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |         ans.push_back(v);
      |         ^~~
      |         abs
decoder.cpp:24:16: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |   for(auto x : ans){
      |                ^~~
      |                abs