Submission #154111

#TimeUsernameProblemLanguageResultExecution timeMemory
154111maruii기억 압축 (JOI15_memory)C++14
100 / 100
2695 ms283340 KiB
#include "Memory_lib.h" int Memory(int N, int M) { int a, s, e, v; a = M >> 21; s = (M >> 14) & ((1 << 7) - 1); e = (M >> 7) & ((1 << 7) - 1); v = M & ((1 << 7) - 1); if (s == N) return -1; if (e >= N) return -2; char c = Get(e + 1); if (s == 0) { if (c == '>' || c == ']') v--; else v++; if (v < 0 || (e + 1 == N && v)) return -2; if (e + 1 == N) return 1 << 14; return (e + 1) << 7 | v; } if (s == e + 1) { if (c == '>' || c == ']') return ((s + 1) << 14) | (s << 7); a = c != '<'; return (a << 21) | (s << 14) | (s << 7) | 1; } if (c == '>' || c == ']') v--; else v++; if (v == 0) { if (a ^ (c != '>')) return -2; return ((s + 1) << 14) | (s << 7); } return (a << 21) | (s << 14) | ((e + 1) << 7) | v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...