# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
592440 | 2022-07-09T08:06:48 Z | dantoh000 | None (JOI15_memory) | C++14 | 2394 ms | 284160 KB |
#include "Memory_lib.h" #include <bits/stdc++.h> int Memory(int N, int M) { if (N <= 30){ int idx = M&31; int flag = M>>5&1; int state = M>>6; if (idx > N) return 0; if (idx == N) return state==0?-1:-2; char ch = Get(idx+1); int type = (ch == '<' || ch == '>') ? 0 : 1; int open = (ch == '<' || ch == '[') ? 1 : 0; if (!open){ if (state == 0) return -2; if (flag^(state&1) == type){ state>>=1; } else return -2; } else{ if (state >= 65536) return -2; state<<=1; if (state == 0){ state = 1; flag = type^1; } else{ state |= (flag^type); } } M = (state<<6)|(flag<<5)|(idx+1); return M>=4194304?-2:M; } else{ int idx = M&127; int ct = M>>7; if (idx > N) return 0; if (idx == N) return (ct==0)?-1:-2; char ch = Get(idx+1); if (ch == '<'){ ct++; } else{ if (ct == 0) return -2; ct--; } M = (ct<<7)|(idx+1); return M>=4194304?-2:M; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2147 ms | 284048 KB | Output is correct |
2 | Correct | 2167 ms | 284160 KB | Output is correct |
3 | Correct | 2221 ms | 284060 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2147 ms | 284048 KB | Output is correct |
2 | Correct | 2167 ms | 284160 KB | Output is correct |
3 | Correct | 2221 ms | 284060 KB | Output is correct |
4 | Correct | 2233 ms | 284020 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2147 ms | 284048 KB | Output is correct |
2 | Correct | 2167 ms | 284160 KB | Output is correct |
3 | Correct | 2221 ms | 284060 KB | Output is correct |
4 | Correct | 2233 ms | 284020 KB | Output is correct |
5 | Correct | 2394 ms | 284008 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2147 ms | 284048 KB | Output is correct |
2 | Correct | 2167 ms | 284160 KB | Output is correct |
3 | Correct | 2221 ms | 284060 KB | Output is correct |
4 | Correct | 2233 ms | 284020 KB | Output is correct |
5 | Correct | 2394 ms | 284008 KB | Output is correct |
6 | Correct | 2376 ms | 283992 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2243 ms | 283928 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2147 ms | 284048 KB | Output is correct |
2 | Correct | 2167 ms | 284160 KB | Output is correct |
3 | Correct | 2221 ms | 284060 KB | Output is correct |
4 | Correct | 2233 ms | 284020 KB | Output is correct |
5 | Correct | 2394 ms | 284008 KB | Output is correct |
6 | Correct | 2376 ms | 283992 KB | Output is correct |
7 | Correct | 2243 ms | 283928 KB | Output is correct |
8 | Correct | 2280 ms | 283992 KB | Output is correct |
9 | Incorrect | 2265 ms | 283972 KB | Wrong Answer [6] |
10 | Halted | 0 ms | 0 KB | - |