# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
56927 |
2018-07-13T08:17:28 Z |
윤교준(#1636) |
기억 압축 (JOI15_memory) |
C++11 |
|
3415 ms |
276948 KB |
#include "Memory_lib.h"
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define sz(V) ((int)(V).size())
using namespace std;
static int f(int i, int j, int k, int l) {
int ret = ((l << 7 | k) << 7 | j) << 7 | i;
//printf("f : %d %d %d %d :: %d\n", i, j, k, l, ret);
return ret;
}
int Memory(int N, int _M) {
if(N&1) return -2;
int i, j, k, l, M = _M;
i = M & 127; M >>= 7;
j = M & 127; M >>= 7;
k = M & 127; M >>= 7;
l = M & 1;
//printf("N=%d, M=%d, i=%d, j=%d, k=%d, l=%d\n", N, _M, i, j, k, l);
if(N < i || i < j || N < k) return -2;
if(i == N) {
if(k == N) return j ? -2 : -1;
return f(0, 0, k+1, 0);
}
if(j == k) {
char c = Get(i+1);
if('>' == c || ']' == c) {
j--;
if(j < 0) return -2;
return f(i+1, j, k, l);
} else {
j++;
l = ('<' == c ? 1 : 0);
return f(i+1, j, k, l);
}
} else if(j == k+1) {
char c = Get(i+1);
if('<' == c || '[' == c) {
j++;
return f(i+1, j, k, l);
} else {
j--;
if('>' == c && !l) return -2;
if(']' == c && l) return -2;
if(j < 0) return -2;
l = 0;
return f(i+1, j, k, l);
}
} else {
char c = Get(i+1);
if('<' == c || '[' == c) j++;
else j--;
if(j < 0) return -2;
return f(i+1, j, k, l);
}
return -2;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3054 ms |
276708 KB |
Output is correct |
2 |
Correct |
2800 ms |
276808 KB |
Output is correct |
3 |
Correct |
2787 ms |
276808 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3054 ms |
276708 KB |
Output is correct |
2 |
Correct |
2800 ms |
276808 KB |
Output is correct |
3 |
Correct |
2787 ms |
276808 KB |
Output is correct |
4 |
Correct |
3415 ms |
276880 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3054 ms |
276708 KB |
Output is correct |
2 |
Correct |
2800 ms |
276808 KB |
Output is correct |
3 |
Correct |
2787 ms |
276808 KB |
Output is correct |
4 |
Correct |
3415 ms |
276880 KB |
Output is correct |
5 |
Correct |
2852 ms |
276880 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3054 ms |
276708 KB |
Output is correct |
2 |
Correct |
2800 ms |
276808 KB |
Output is correct |
3 |
Correct |
2787 ms |
276808 KB |
Output is correct |
4 |
Correct |
3415 ms |
276880 KB |
Output is correct |
5 |
Correct |
2852 ms |
276880 KB |
Output is correct |
6 |
Correct |
2973 ms |
276948 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3179 ms |
276948 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3054 ms |
276708 KB |
Output is correct |
2 |
Correct |
2800 ms |
276808 KB |
Output is correct |
3 |
Correct |
2787 ms |
276808 KB |
Output is correct |
4 |
Correct |
3415 ms |
276880 KB |
Output is correct |
5 |
Correct |
2852 ms |
276880 KB |
Output is correct |
6 |
Correct |
2973 ms |
276948 KB |
Output is correct |
7 |
Correct |
3179 ms |
276948 KB |
Output is correct |
8 |
Correct |
2694 ms |
276948 KB |
Output is correct |
9 |
Correct |
3182 ms |
276948 KB |
Output is correct |