Submission #282820

#TimeUsernameProblemLanguageResultExecution timeMemory
282820arnold518기억 압축 (JOI15_memory)C++14
0 / 100
2822 ms283788 KiB
#include "Memory_lib.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; int encode(int sz, int mch, int st) { return (st<<8)|(mch<<4)|(sz); } int Memory(int N, int M) { if(N%2) return -2; int sz=M&15; M>>=4; int mch=M&15; M>>=4; int st=M; char c=Get(mch*2+sz+1); if(c=='<') { st<<=1; sz++; if(sz>N/2) return -2; } else if(c=='[') { st<<=1; st|=1; sz++; if(sz>N/2) return -2; } else if(c=='>') { if(sz==0) return -2; if((st&1)!=0) return -2; sz--; st>>=1; mch++; } else if(c==']') { if(sz==0) return -2; if((st&1)!=1) return -2; sz--; st>>=1; mch++; } if(mch*2+sz==N) { if(sz==0) return -1; return -2; } return encode(sz, mch, st); }
#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...