Submission #262116

#TimeUsernameProblemLanguageResultExecution timeMemory
262116maximath_1Parrots (IOI11_parrots)C++11
Compilation error
0 ms0 KiB
#include "encoder.h" #include <iostream> #include <string> #include <algorithm> #include <string.h> using namespace std; struct big_num{ int arr[105]; void init(int x){ memset(arr, 0, sizeof(arr)); arr[0] = x; } }; big_num operator+(big_num a, big_num b){ for(int i = 0; i < 100; i ++){ a.arr[i] += b.arr[i]; if(a.arr[i] > 256){ a.arr[i] -= 256; a.arr[i + 1] ++; } } return a; } bool operator<(big_num a, big_num b){ for(int i = 104; i >= 0; i --){ if(a.arr[i] < b.arr[i]) return 1; if(a.arr[i] > b.arr[i]) return 0; } return 0; } big_num C[605][605]; bool done = false; void encode(int N, int M[]){ if(!done){ for(int i = 0; i < 605; i ++){ C[i][0].init(1); for(int j = 1; j <= i; j ++){ C[i][j].init(0); C[i][j] = C[i - 1][j] + C[i - 1][j - 1]; } for(int j = i + 1; j < 600; j ++) C[i][j].init(0); } done = 1; } big_num base, nw; nw.init(0); base.init(0); for(int i = 0; i < N; i ++) nw.arr[i] = M[i]; int len = 255 + 5 * N; for(int i = 0; i < 5 * N; i ++){ while(nw < C[len - 1][5 * N - i] + base) len --; send(5 * N + 255 - len - i - 1); base = base + C[len - 1][5 * N - i]; len --; } }
#include "decoder.h" #include <iostream> #include <string> #include <algorithm> #include <string.h> using namespace std; struct big__num{ int arr[105]; void init(int x){ memset(arr, 0, sizeof(arr)); arr[0] = x; } }; big__num operator+(big__num a, big__num b){ for(int i = 0; i < 100; i ++){ a.arr[i] += b.arr[i]; if(a.arr[i] > 256){ a.arr[i] -= 256; a.arr[i + 1] ++; } } return a; } bool operator<(big__num a, big__num b){ for(int i = 104; i >= 0; i --){ if(a.arr[i] < b.arr[i]) return 1; if(a.arr[i] > b.arr[i]) return 0; } return 0; } big__num C_[605][605]; bool done_ = false; void decode(int N, int L, int X[]){ if(!done_){ for(int i = 0; i < 605; i ++){ C_[i][0].init(1); for(int j = 1; j <= i; j ++){ C_[i][j].init(0); C_[i][j] = C_[i - 1][j] + C_[i - 1][j - 1]; } for(int j = i + 1; j < 600; j ++) C_[i][j].init(0); } done_ = 1; } sort(X, X + L); big__num res; res.init(0); for(int i = 0; i < L; i ++) res = res + C_[5 * N + 255 - X[i] - i - 2][5 * N - i]; for(int i = 0; i < N; i ++) output(res.arr[i]); }

Compilation message (stderr)

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:56:3: error: 'send' was not declared in this scope
   send(5 * N + 255 - len - i - 1);
   ^~~~
encoder.cpp:56:3: note: suggested alternative: 'len'
   send(5 * N + 255 - len - i - 1);
   ^~~~
   len

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:56:3: error: 'output' was not declared in this scope
   output(res.arr[i]);
   ^~~~~~
decoder.cpp:56:3: note: suggested alternative: 'getpt'
   output(res.arr[i]);
   ^~~~~~
   getpt