Submission #592503

#TimeUsernameProblemLanguageResultExecution timeMemory
592503tqbfjotld기억 압축 (JOI15_memory)C++14
0 / 100
61 ms7308 KiB
#include "Memory_lib.h" #include <bits/stdc++.h> using namespace std; int Memory(int N, int M) { if (N>30){ int loc = M%(N+1); int rem = M/(N+1); if (loc==N) return rem==0?-1:-2; int res = Get(loc+1); if (res=='>'){ if (rem==0) return -2; rem--; } else{ rem++; } return rem*(N+1)+loc+1; } int loc = M%(N+1); int rem = M/(N+1); int rems = rem&15; int remm = rem>>4; if (loc==N){ return rems==0?-1:-2; } int res = Get(loc+1); if (res==']' || res=='>'){ if (rems==0) return -2; if ((remm&1)==(res==']')){ rems--; remm>>=1; } else{ return -2; } } else{ if (rems==15){ return -2; } rems++; remm<<=1; remm += (res=='['); } return ((remm<<4)+rems)*(N+1)+(loc+1); }
#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...