Submission #883456

#TimeUsernameProblemLanguageResultExecution timeMemory
883456dejandenibParrots (IOI11_parrots)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "encoder.h" #include "encoderlib.h" #include "decoder.h" #include "decoderlib.h" using namespace std; void encode(int n, int a[]) { for(int i =0;i<n;i++) { int k; k = 0; int tosend = 0; int x = i; for (int j=0;j<5;j++) { if ((i & (1<<j))>0) { tosend+=1<<k; } k+=1; } tosend<<=3; for (int j=0;j<8;j++) { if ( (a[i] & (1<<j))>0) { send(tosend+j); } } } } void decode(int n,int howmany2,int a[]){ int to_be_output[321]; for (int i =0;i<n;i++) to_be_output[i]=0; for(int i = 0;i<howmany2;i++) { int value = 0; int k = 0; for (int j = 0;j<3;j++) { if (a[i] %2==1) value+=1<<k; k+=1; a[i]=a[i]/2; } value = 1<<value; int position=0; k = 0; for (int j = 0;j<5;j++) { if (a[i] %2==1) position+=1<<k; k+=1; a[i]=a[i]/2; } to_be_output[position]+=value; } for(int i =0;i<n;i++) output(to_be_output[i]); }
#include <bits/stdc++.h> #include "encoder.h" #include "encoderlib.h" #include "decoder.h" #include "decoderlib.h" using namespace std; void encode(int n, int a[]) { for(int i =0;i<n;i++) { int k; k = 0; int tosend = 0; int x = i; for (int j=0;j<5;j++) { if ((i & (1<<j))>0) { tosend+=1<<k; } k+=1; } tosend<<=3; for (int j=0;j<8;j++) { if ( (a[i] & (1<<j))>0) { send(tosend+j); } } } } void decode(int n,int howmany2,int a[]){ int to_be_output[321]; for (int i =0;i<n;i++) to_be_output[i]=0; for(int i = 0;i<howmany2;i++) { int value = 0; int k = 0; for (int j = 0;j<3;j++) { if (a[i] %2==1) value+=1<<k; k+=1; a[i]=a[i]/2; } value = 1<<value; int position=0; k = 0; for (int j = 0;j<5;j++) { if (a[i] %2==1) position+=1<<k; k+=1; a[i]=a[i]/2; } to_be_output[position]+=value; } for(int i =0;i<n;i++) output(to_be_output[i]); }

Compilation message (stderr)

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:16:13: warning: unused variable 'x' [-Wunused-variable]
   16 |         int x = i;
      |             ^
/usr/bin/ld: /tmp/ccLXZFFM.o: in function `decode(int, int, int*)':
encoder.cpp:(.text+0x1ea): undefined reference to `output(int)'
collect2: error: ld returned 1 exit status

decoder.cpp: In function 'void encode(int, int*)':
decoder.cpp:16:13: warning: unused variable 'x' [-Wunused-variable]
   16 |         int x = i;
      |             ^
/usr/bin/ld: /tmp/ccwNCVYA.o: in function `encode(int, int*)':
decoder.cpp:(.text+0x7c): undefined reference to `send(int)'
collect2: error: ld returned 1 exit status