답안 #282183

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
282183 2020-08-24T06:00:18 Z 최은수(#5756) 기억 압축 (JOI15_memory) C++17
25 / 100
2984 ms 283848 KB
#include"Memory_lib.h"
#include<iostream>
#include<vector>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;
int Memory(int N,int M)
{
    if(N%2==1)
        return-2;
    int cur=M/4096/(N/2+1);
    int ssz=M/4096%(N/2+1);
    int stv=M%4096;
    if(cur>=N||ssz>cur)
        return-2;
    char c=Get(cur+1);
    if(c=='<'||c=='[')
        stv+=(c=='<'?0:1)<<ssz++;
    else
    {
        if(ssz==0)
            return-2;
        ssz--;
        int v=c=='>'?0:1;
        if((stv>>ssz&1)!=v)
            return-2;
        stv-=v<<ssz;
    }
    if(ssz>N/2)
        return-2;
    if(cur==N-1)
        return ssz==0?-1:-2;
    return stv+ssz*4096+(cur+1)*4096*(N/2+1);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2836 ms 283848 KB Output is correct
2 Correct 2862 ms 283700 KB Output is correct
3 Correct 2891 ms 283732 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2836 ms 283848 KB Output is correct
2 Correct 2862 ms 283700 KB Output is correct
3 Correct 2891 ms 283732 KB Output is correct
4 Correct 2906 ms 283612 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2836 ms 283848 KB Output is correct
2 Correct 2862 ms 283700 KB Output is correct
3 Correct 2891 ms 283732 KB Output is correct
4 Correct 2906 ms 283612 KB Output is correct
5 Correct 2912 ms 283676 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2836 ms 283848 KB Output is correct
2 Correct 2862 ms 283700 KB Output is correct
3 Correct 2891 ms 283732 KB Output is correct
4 Correct 2906 ms 283612 KB Output is correct
5 Correct 2912 ms 283676 KB Output is correct
6 Incorrect 2984 ms 283596 KB Wrong Answer [6]
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 256 KB Wrong Answer [1]
# 결과 실행 시간 메모리 Grader output
1 Correct 2836 ms 283848 KB Output is correct
2 Correct 2862 ms 283700 KB Output is correct
3 Correct 2891 ms 283732 KB Output is correct
4 Correct 2906 ms 283612 KB Output is correct
5 Correct 2912 ms 283676 KB Output is correct
6 Incorrect 2984 ms 283596 KB Wrong Answer [6]