답안 #217492

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
217492 2020-03-30T02:54:38 Z EntityIT 기억 압축 (JOI15_memory) C++14
0 / 100
5 ms 384 KB
#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);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Wrong Answer [3]
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -