# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
56926 |
2018-07-13T08:13:08 Z |
윤교준(#1636) |
None (JOI15_memory) |
C++11 |
|
4259 ms |
276992 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>>1) <= k) return -2;
if(i == N) {
if(k+1 == (N>>1)) return j ? -2 : -1;
return f(0, 0, k+1, 0);
}
if(j+1 == 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) {
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;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3610 ms |
276724 KB |
Output is correct |
2 |
Incorrect |
3660 ms |
276924 KB |
Wrong Answer [6] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3610 ms |
276724 KB |
Output is correct |
2 |
Incorrect |
3660 ms |
276924 KB |
Wrong Answer [6] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3610 ms |
276724 KB |
Output is correct |
2 |
Incorrect |
3660 ms |
276924 KB |
Wrong Answer [6] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3610 ms |
276724 KB |
Output is correct |
2 |
Incorrect |
3660 ms |
276924 KB |
Wrong Answer [6] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4259 ms |
276992 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3610 ms |
276724 KB |
Output is correct |
2 |
Incorrect |
3660 ms |
276924 KB |
Wrong Answer [6] |
3 |
Halted |
0 ms |
0 KB |
- |