# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
120054 |
2019-06-23T07:01:09 Z |
tjd229 |
None (JOI15_memory) |
C++14 |
|
2056 ms |
276732 KB |
#include "Memory_lib.h"
const int sq7 = 128;
const int sq6 = 64;
int concat(int l,int r,int op,int mode) {
return mode + (op << 2) + (r << 8) + (l << 15);
}
int Memory(int N, int M) {
if (N & 1) return -2;
int mode = M & 3; M >>= 2;
int op = M & (sq6 - 1); M >>= 6;
int r = M & (sq7 - 1); // i
int l = M >> 7; //j
if (r == N)
return op ? -2 : -1;
if (l == N) return -2;
if (l == r) {
char c = Get(++l);
if (c == ']' || c == '>') {
if (--op < 0) return -2;
return concat(l,++r,op,mode);
}
else {
mode = (c == '[') + 1;
op = 1;
return concat(l, r, op, mode);
}
}
else {
char c = Get(++l);
switch (c) {
case '<':case '[':
++op;
break;
case '>':
--op;
if (op < 0) return -2;
if (l > r && op == 0) {
if (mode != 1) return -2;
return concat(0, ++r, op, 0);
}
break;
case ']':
--op;
if (op < 0) return -2;
if (l > r && op == 0) {
if (mode != 2) return -2;
return concat(0, ++r, op, 0);
}
break;
}
}
//op>50 chk
if (op > (N >> 1)) return -2;
return concat(l,r,op,mode);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2056 ms |
276732 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 KB |
Wrong Answer [3] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2056 ms |
276732 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 KB |
Wrong Answer [3] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2056 ms |
276732 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 KB |
Wrong Answer [3] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2056 ms |
276732 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 KB |
Wrong Answer [3] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Wrong Answer [3] |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2056 ms |
276732 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 KB |
Wrong Answer [3] |
3 |
Halted |
0 ms |
0 KB |
- |