Submission #370850

#TimeUsernameProblemLanguageResultExecution timeMemory
370850SortingParrots (IOI11_parrots)C++17
Compilation error
0 ms0 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; const int H = 320 + 256 + 3; const int SZ = 80; struct Big_Number{ int a[SZ]; void init(){ fill(a, a + SZ, 0); } Big_Number(){ init(); } friend Big_Number operator+(const Big_Number &l, const Big_Number &r){ int add = 0; Big_Number ret; for(int i = SZ - 1; i >= 0; --i){ int sum = l.a[i] + r.a[i] + add; ret.a[i] = sum % 256; add = sum / 256; } return ret; } friend bool operator<(const Big_Number &l, const Big_Number &r){ for(int i = 0; i < SZ; ++i) if(l.a[i] != r.a[i]) return l.a[i] < r.a[i]; return false; } }; static bool done = false; static Big_Number bc[H][H]; void encode(int n, int m[]){ if(!done){ bc[0][0].a[SZ - 1] = 1; for(int i = 0; i < H; ++i){ bc[i][0].a[SZ - 1] = 1; for(int j = 1; j < i; ++j) bc[i][j] = bc[i - 1][j] + bc[i - 1][j - 1]; if(i) bc[i][i].a[SZ - 1] = 1; } done = true; } int t = 5 * n, num = 255; Big_Number curr, add; for(int i = 0; i < n; ++i) curr.a[SZ - 1 - i] = m[i]; for(; t > 0; --t){ while(num && curr < bc[t + num - 1][t] + add) num--; send(num); add = add + bc[t + num - 1][t]; } }

Compilation message (stderr)

/tmp/ccNbTW25.o: In function `main':
grader_decoder.cpp:(.text.startup+0x21f): undefined reference to `decode(int, int, int*)'
collect2: error: ld returned 1 exit status