# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
282158 |
2020-08-24T05:02:31 Z |
반딧불(#5757) |
None (JOI15_memory) |
C++17 |
|
6000 ms |
283748 KB |
#include <bits/stdc++.h>
#include "Memory_lib.h"
#define ensure(x) if(!(x)) return -2;
bool arr[12]; /// <> : 0, [] : 1
int Memory(int n, int k){
for(int i=0; i<12; i++) arr[i] = (k>>i) & 1;
int stackSize = (k>>12) & 31;
int location = (k>>17) & 31;
location++;
ensure(1 <= location && location <= n);
char tmp = Get(location);
if(tmp == '>' || tmp == ']'){
if(stackSize == 0) return -2;
if(tmp == '>' && arr[stackSize-1] == 1) return -2;
if(tmp == ']' && arr[stackSize-1] == 0) return -2;
stackSize--;
arr[stackSize] = 0;
}
else{
if(stackSize >= 12) return -2;
arr[stackSize] = (tmp == '<') ? 0 : 1;
stackSize++;
}
if(location == n){
if(stackSize==0) return -1;
return -2;
}
k=0;
for(int i=0; i<12; i++) if(arr[i]) k |= (1<<i);
k += stackSize << 12;
k += location << 17;
return k;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3209 ms |
283748 KB |
Output is correct |
2 |
Execution timed out |
6064 ms |
384 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3209 ms |
283748 KB |
Output is correct |
2 |
Execution timed out |
6064 ms |
384 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3209 ms |
283748 KB |
Output is correct |
2 |
Execution timed out |
6064 ms |
384 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3209 ms |
283748 KB |
Output is correct |
2 |
Execution timed out |
6064 ms |
384 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
6044 ms |
256 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3209 ms |
283748 KB |
Output is correct |
2 |
Execution timed out |
6064 ms |
384 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |