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;
int Memory(int N, int M) {
int n = M%30, x = M/30;
if (n >= N) return -2;
if (x == 0) x = 1;
if (x >= (1<<16)) return -2;
char c = Get(n+1);
if (c == '<') x = x * 2;
if (c == '[') x = x * 2 + 1;
if (c == '>') {
if (x % 2 == 1) return -2;
else x /= 2;
}
if (c == ']') {
if (x == 1 || x % 2 == 0) return -2;
else x /= 2;
}
if (n == N-1) {
if (x == 1) return -1;
else return -2;
}
else {
int nxt = x * 30 + n + 1;
if (nxt >= (1<<22)) return -2;
else return nxt;
}
}
# | 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... |