Submission #67357

#TimeUsernameProblemLanguageResultExecution timeMemory
67357zetapiParrots (IOI11_parrots)C++14
Compilation error
0 ms0 KiB
#include "encoder.h" #include "encoderlib.h" #include "bits/stdc++.h" using namespace std; #define pb push_back #define mp make_pair #define ll long long #define itr ::iterator typedef pair<int,int> pii; const int MAX=1e5; void encode(int N,int M[]) { int arr[1000]; vector<int> vec; for(int A=0;A<N;A++) { send(-M[A]); vec.pb(mp(M[A],A)); } sort(vec.begin(),vec.end()); for(int A=0;A<vec.size();A++) arr[vec[A].second]=A; for(int A=0;A<N;A++) { int res=A; for(int B=0;B<8;B++) { if(arr[A]&(1<<B)) res+=1<<(B+4); } send(res); } return ; }#include "encoder.h" #include "encoderlib.h" #include "bits/stdc++.h" using namespace std; #define pb push_back #define mp make_pair #define ll long long #define itr ::iterator typedef pair<int,int> pii; const int MAX=1e5; void encode(int N,int M[]) { int arr[1000]; vector<int> vec; for(int A=0;A<N;A++) { send(-M[A]); vec.pb(mp(M[A],A)); } sort(vec.begin(),vec.end()); for(int A=0;A<vec.size();A++) arr[vec[A].second]=A; for(int A=0;A<N;A++) { int res=A; for(int B=0;B<8;B++) { if(arr[A]&(1<<B)) res+=1<<(B+4); } send(res); } return ; }
#include "decoder.h" #include "decoderlib.h" #include "bits/stdc++.h" using namespace std; #define pb push_back #define mp make_pair #define ll long long #define itr ::iterator typedef pair<int,int> pii; const int MAX=1e5; void decode(int N, int L, int X[]) { int res[1000]; vector<int> vec; for(int A=0;A<L;A++) if(X[A]<0) vec.pb(-X[A]); sort(vec.begin(),vec.end()); for(int A=0;A<L;A++) { if(X[A]<0) continue; int ind=0,num=0; for(int B=0;B<4;B++) if(X[A+N]&(1<<B)) ind+=(1<<B); for(int B=0;B<8;B++) if(X[A+N]&(1<<(B+4))) num+=(1<<B); res[ind]=num; } for(int A=0;A<N;A++) output(vec[res[A]]); return ; }

Compilation message (stderr)

encoder.cpp:38:2: error: stray '#' in program
 }#include "encoder.h"
  ^
encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:22:20: error: no matching function for call to 'std::vector<int>::push_back(std::pair<int, int>)'
   vec.pb(mp(M[A],A));
                    ^
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from encoder.cpp:3:
/usr/include/c++/7/bits/stl_vector.h:939:7: note: candidate: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]
       push_back(const value_type& __x)
       ^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:939:7: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'const value_type& {aka const int&}'
/usr/include/c++/7/bits/stl_vector.h:953:7: note: candidate: void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]
       push_back(value_type&& __x)
       ^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:953:7: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'std::vector<int>::value_type&& {aka int&&}'
encoder.cpp:25:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int A=0;A<vec.size();A++)
              ~^~~~~~~~~~~
encoder.cpp:26:14: error: request for member 'second' in 'vec.std::vector<int>::operator[](((std::vector<int>::size_type)A))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
   arr[vec[A].second]=A;
              ^~~~~~
encoder.cpp: At global scope:
encoder.cpp:38:3: error: 'include' does not name a type; did you mean 'encode'?
 }#include "encoder.h"
   ^~~~~~~
   encode
encoder.cpp:50:11: error: redefinition of 'const int MAX'
 const int MAX=1e5;
           ^~~
encoder.cpp:13:11: note: 'const int MAX' previously defined here
 const int MAX=1e5;
           ^~~
encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:52:6: error: redefinition of 'void encode(int, int*)'
 void encode(int N,int M[])
      ^~~~~~
encoder.cpp:15:6: note: 'void encode(int, int*)' previously defined here
 void encode(int N,int M[])
      ^~~~~~
encoder.cpp:59:20: error: no matching function for call to 'std::vector<int>::push_back(std::pair<int, int>)'
   vec.pb(mp(M[A],A));
                    ^
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from encoder.cpp:3:
/usr/include/c++/7/bits/stl_vector.h:939:7: note: candidate: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]
       push_back(const value_type& __x)
       ^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:939:7: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'const value_type& {aka const int&}'
/usr/include/c++/7/bits/stl_vector.h:953:7: note: candidate: void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]
       push_back(value_type&& __x)
       ^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:953:7: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'std::vector<int>::value_type&& {aka int&&}'
encoder.cpp:62:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int A=0;A<vec.size();A++)
              ~^~~~~~~~~~~
encoder.cpp:63:14: error: request for member 'second' in 'vec.std::vector<int>::operator[](((std::vector<int>::size_type)A))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
   arr[vec[A].second]=A;
              ^~~~~~