# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
199203 | arnold518 | 기억 압축 (JOI15_memory) | C++14 | 2790 ms | 284040 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 Memory(int N, int M)
{
int i, j;
//printf("%d\n", M);
if(N%2) return -2;
if(M==0) return 33;
int pos=(M&31), mask=M>>5, sz;
if(mask==0) return -2;
if(pos==0) return -2;
for(i=16; i>=0; i--) if(mask&(1<<i)) { sz=i; break; }
if(sz>N/2) return -2;
if(pos==N+1)
{
if(sz==0 && mask==1) return -1;
return -2;
}
if(pos>N) return -2;
char t=Get(pos);
//printf("%d -> %d %d %d %c\n", M, pos, mask, sz, t);
if(t=='<')
{
mask<<=1; sz++;
if(sz>N/2) return -2;
}
else if(t=='[')
{
mask<<=1; sz++;
mask|=1;
if(sz>N/2) return -2;
}
else if(t=='>')
{
if(sz==0) return -2;
if((mask&1)==1) return -2;
sz--; mask>>=1;
}
else if(t==']')
{
if(sz==0) return -2;
if((mask&1)==0) return -2;
sz--; mask>>=1;
}
pos++;
return (mask<<5)|pos;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |