# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
592414 |
2022-07-09T07:22:58 Z |
joelau |
None (JOI15_memory) |
C++14 |
|
2287 ms |
284148 KB |
#include "Memory_lib.h"
#include <bits/stdc++.h>
using namespace std;
int Memory(int N, int M) {
if (N <= 30) {
int n = M%30, x = M/30;
if (n >= N) return -2;
if (x == 0) x = 1;
if (x >= (1<<16)) return -2;
char c = Get(n+1);
if (c == '<') x = x * 2;
if (c == '[') x = x * 2 + 1;
if (c == '>') {
if (x % 2 == 1) return -2;
else x /= 2;
}
if (c == ']') {
if (x == 1 || x % 2 == 0) return -2;
else x /= 2;
}
if (n == N-1) {
if (x == 1) return -1;
else return -2;
}
else {
int nxt = x * 30 + n + 1;
if (nxt >= (1<<22)) return -2;
else return nxt;
}
}
else {
int n = M / 100, x = M % 100;
if (n >= N) return -2;
char c = Get(n+1);
if (c == '<') x++;
else x--;
if (x < 0) return -2;
if (n == N-1) return x == 0 ? -1 : -2;
int nxt = (n+1) * 100 + x;
if (nxt >= (1<<22)) return -2;
else return nxt;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2093 ms |
283980 KB |
Output is correct |
2 |
Correct |
2199 ms |
284020 KB |
Output is correct |
3 |
Correct |
2214 ms |
283988 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2093 ms |
283980 KB |
Output is correct |
2 |
Correct |
2199 ms |
284020 KB |
Output is correct |
3 |
Correct |
2214 ms |
283988 KB |
Output is correct |
4 |
Correct |
2257 ms |
284004 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2093 ms |
283980 KB |
Output is correct |
2 |
Correct |
2199 ms |
284020 KB |
Output is correct |
3 |
Correct |
2214 ms |
283988 KB |
Output is correct |
4 |
Correct |
2257 ms |
284004 KB |
Output is correct |
5 |
Correct |
2287 ms |
284040 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2093 ms |
283980 KB |
Output is correct |
2 |
Correct |
2199 ms |
284020 KB |
Output is correct |
3 |
Correct |
2214 ms |
283988 KB |
Output is correct |
4 |
Correct |
2257 ms |
284004 KB |
Output is correct |
5 |
Correct |
2287 ms |
284040 KB |
Output is correct |
6 |
Correct |
2237 ms |
284104 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2187 ms |
284000 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2093 ms |
283980 KB |
Output is correct |
2 |
Correct |
2199 ms |
284020 KB |
Output is correct |
3 |
Correct |
2214 ms |
283988 KB |
Output is correct |
4 |
Correct |
2257 ms |
284004 KB |
Output is correct |
5 |
Correct |
2287 ms |
284040 KB |
Output is correct |
6 |
Correct |
2237 ms |
284104 KB |
Output is correct |
7 |
Correct |
2187 ms |
284000 KB |
Output is correct |
8 |
Correct |
2129 ms |
284024 KB |
Output is correct |
9 |
Incorrect |
2075 ms |
284148 KB |
Wrong Answer [6] |
10 |
Halted |
0 ms |
0 KB |
- |