답안 #101187

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
101187 2019-03-17T09:18:17 Z Pro_ktmr 기억 압축 (JOI15_memory) C++14
100 / 100
2790 ms 276908 KB
#include"Memory_lib.h"

int Memory(int N, int M){
    int roopCount = (M >> 15) % (1 << 7);
    int now = (M >> 8) % (1 << 7);
    int length = (M >> 1) % (1 << 7);
    int stack = (M >> 0) % (1 << 1);
    if(roopCount >= N || now >= N || length >= N) return 0;

    char c = Get(now+1);
    if(c == '<'){
        if(length == roopCount) stack = 0;
        length++;
    }
    if(c == '['){
        if(length == roopCount) stack = 1;
        length++;
    }
    if(c == '>'){
        if(length == 0) return -2;
        length--;
        if(length == roopCount && stack != 0) return -2;
    }
    if(c == ']'){
        if(length == 0) return -2;
        length--;
        if(length == roopCount && stack != 1) return -2;
    }

    now++;
    if(now == N){
        if(length != 0) return -2;
        roopCount++;
        now = 0;
        length = 0;
        stack = 0;
    }
    if(roopCount == N) return -1;
    return (roopCount<<15) | (now<<8) | (length<<1) | (stack<<0);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2514 ms 276908 KB Output is correct
2 Correct 2563 ms 276732 KB Output is correct
3 Correct 2544 ms 276660 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2514 ms 276908 KB Output is correct
2 Correct 2563 ms 276732 KB Output is correct
3 Correct 2544 ms 276660 KB Output is correct
4 Correct 2378 ms 276740 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2514 ms 276908 KB Output is correct
2 Correct 2563 ms 276732 KB Output is correct
3 Correct 2544 ms 276660 KB Output is correct
4 Correct 2378 ms 276740 KB Output is correct
5 Correct 2790 ms 276772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2514 ms 276908 KB Output is correct
2 Correct 2563 ms 276732 KB Output is correct
3 Correct 2544 ms 276660 KB Output is correct
4 Correct 2378 ms 276740 KB Output is correct
5 Correct 2790 ms 276772 KB Output is correct
6 Correct 2625 ms 276608 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2558 ms 276704 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2514 ms 276908 KB Output is correct
2 Correct 2563 ms 276732 KB Output is correct
3 Correct 2544 ms 276660 KB Output is correct
4 Correct 2378 ms 276740 KB Output is correct
5 Correct 2790 ms 276772 KB Output is correct
6 Correct 2625 ms 276608 KB Output is correct
7 Correct 2558 ms 276704 KB Output is correct
8 Correct 2690 ms 276620 KB Output is correct
9 Correct 2522 ms 276596 KB Output is correct