Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- c o w
- "Begin the Escape exeOt the BnCak cutioWofO aCreW Dawn"
- unenc(c, o, w)
- "Begin the Escape exeOt the Bn aCreak cutioWof Dawn"
- RIGHT
- ...
- reenc(c, o, w)
- "Begin the Escape CnCak OexeOt the BWcutioWofO aCreW Dawn"
- NOT
- "Begin the Escape exeOt the BnCak cutioWofO aCreW Dawn"
- */
- void unenc(int c, int o, int w) {
- if (next[c] == o) {
- if (next[o] == w) {
- next[prev[c]] = next[w];
- prev[next[w]] = prev[c];
- } else {
- next[prev[c]] = next[o];
- prev[next[o]] = prev[c];
- next[prev[w]] = next[w];
- prev[next[w]] = prev[w];
- }
- } else {
- if (next[o] == w) {
- next[prev[c]] = next[c];
- prev[next[c]] = prev[c];
- next[prev[o]] = next[w];
- prev[next[w]] = prev[o];
- } else {
- next[prev[c]] = next[o];
- prev[next[o]] = prev[c];
- next[prev[w]] = next[c];
- prev[next[c]] = prev[w];
- next[prev[o]] = next[w];
- prev[next[w]] = prev[o];
- }
- }
- }
- void reenc(int c, int o, int w) {
- next[prev[c]] = c;
- prev[next[c]] = c;
- next[prev[o]] = o;
- prev[next[o]] = o;
- next[prev[w]] = w;
- prev[next[w]] = w;
- }
Advertisement
Add Comment
Please, Sign In to add comment