ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1307. Archiver

bitstream via C/C++
Posted by SkorKNURE 26 Oct 2008 20:04
I solved this problem with the Huffman encoding. It was not so complicated, but I wanna know how we can efficiently save out bitstream (1-0-encoded planetext) into the file?

1) I used only 7 bits from char and last (msb) bit always was '1' - because if we will use all 8 bits, we will get some  unprintable characters. How can we avoid this problem?

2) Also, did anybody think about using wchar_t for encode 16 bits in 1 character? Is it possible for our problem?

3) And last question. How can we store all char-encoded bitset in one string? I can't compile very long char sequences like

> const char *str = "asdjgagsd....asdgah";

with MSVC++. I have divided all char stream into

> char str[][10000] + {"ewfw..ewf","afe...",...};

Can we do it more efficiently?

Thanks :)

Edited by author 26.10.2008 20:06