# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
781843 |
2023-07-13T11:55:39 Z |
ymm |
None (JOI15_memory) |
C++17 |
|
1749 ms |
283852 KB |
#include "Memory_lib.h"
namespace {
int get_p(int x) { return x % 100; }
int get_phase(int x) { return x / 100 % 2; }
int get_p2(int x) { return x / 200 % 100 - 1; }
int get_depth(int x) { return x / 20000 % 100; }
char get_ch(int x) { return x / 2000000? '<': '['; }
int make(int p, int phase, int p2, int depth, int c) {
c = c == '<' || c == '>';
return p + phase * 100 + (p2 + 1) * 200 + depth * 20000 + c * 2000000;
}
char get(int i, int phase, int len) {
if (!phase)
return Get(i+1);
char c = Get(len - i);
switch (c) {
case '<': return '>';
case '>': return '<';
case '[': return ']';
case ']': return '[';
}
return -1;
}
}
int Memory(int N, int M) {
int p = get_p(M);
int phase = get_phase(M);
int p2 = get_p2(M);
int depth = get_depth(M);
char ch = get_ch(M);
if (p2 == -1) {
char c = get(p, phase, N);
if (c == '[' || c == '<') {
if (p == N-1)
return -2;
else
return make(p+1, phase, -1, 0, 0);
}
return make(p, phase, p-1, 0, c);
}
char c = get(p2, phase, N);
if (c == ']' || c == '>') {
if (p2 == 0)
return -2;
return make(p, phase, p2-1, depth+1, ch);
}
if (depth) {
if (p2 == 0)
return -2;
return make(p, phase, p2-1, depth-1, ch);
}
if (c != ch)
return -2;
if (p == N-1) {
if (phase == 0)
return make(0, 1, -1, 0, 0);
else
return -1;
}
return make(p+1, phase, -1, 0, 0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1749 ms |
283852 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |