Submission #282153

# Submission time Handle Problem Language Result Execution time Memory
282153 2020-08-24T04:57:24 Z 반딧불(#5757) None (JOI15_memory) C++17
0 / 100
6000 ms 283924 KB
#include <bits/stdc++.h>
#include "Memory_lib.h"
#define ensure(x) if(!(x)) return -2;

bool arr[12]; /// <> : 0, [] : 1

int Memory(int n, int k){
    for(int i=0; i<12; i++) arr[i] = (k>>i) & 1;
    int stackSize = (k>>12) & 31;
    int location = (k>>17) & 31;
    location++;

    if(location == n+1){
        if(stackSize==0) return -1;
        return -2;
    }

    ensure(1 <= location && location <= n);
    char tmp = Get(location);
    if(tmp == '>' || tmp == ']'){
        if(stackSize == 0) return -2;
        if(tmp == '>' && arr[stackSize-1] == 1) return -2;
        if(tmp == ']' && arr[stackSize-1] == 0) return -2;
        stackSize--;
        arr[stackSize] = 0;
    }
    else{
        if(stackSize >= 12) return -2;
        arr[stackSize] = (tmp == '<') ? 0 : 1;
        stackSize++;
    }

    k=0;
    for(int i=0; i<12; i++) if(arr[i]) k |= (1<<i);
    k += stackSize << 12;
    k += location << 17;
    return k;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3085 ms 283924 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3085 ms 283924 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3085 ms 283924 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3085 ms 283924 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6047 ms 256 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Incorrect 3085 ms 283924 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -