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<bits/stdc++.h>
using namespace std;
#include "Memory_lib.h"
#define all(x) (x).begin(), (x).end()
#define sz(x) ( (int)(x).size() )
using LL = long long;
const int LIM = (1 << 7) - 1;
mt19937 rng( (uint32_t)chrono::steady_clock::now().time_since_epoch().count() );
int Memory(int N, int M) {
int checkedDep = M & LIM,
dep = (M >> 7) & LIM,
pos = ( (M >> 14) & LIM) + 1,
lst = M >> 21;
char tmp = Get(pos);
if (tmp == '<') {
if (dep++ == checkedDep) lst = 0;
}
else if (tmp == '>') {
if (--dep == checkedDep) {
if (lst) return -2;
}
}
else if (tmp == '[') {
if (dep++ == checkedDep) lst = 1;
}
else {
if (--dep == checkedDep) {
if (!lst) return -2;
}
}
if (dep < 0) return -2;
if (pos == N) {
if (dep) return -2;
else {
if (checkedDep == N >> 1) return -1;
++checkedDep;
pos = 0;
}
}
return checkedDep | (dep << 7) | (pos << 14) | (lst << 21);
}
# | 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... |