# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
282160 |
2020-08-24T05:03:44 Z |
반딧불(#5757) |
None (JOI15_memory) |
C++17 |
|
3521 ms |
283896 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 && 0 <= stackSize && stackSize <= 12);
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 |
3139 ms |
283896 KB |
Output is correct |
2 |
Correct |
3111 ms |
283704 KB |
Output is correct |
3 |
Correct |
3179 ms |
283752 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3139 ms |
283896 KB |
Output is correct |
2 |
Correct |
3111 ms |
283704 KB |
Output is correct |
3 |
Correct |
3179 ms |
283752 KB |
Output is correct |
4 |
Correct |
3246 ms |
283744 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3139 ms |
283896 KB |
Output is correct |
2 |
Correct |
3111 ms |
283704 KB |
Output is correct |
3 |
Correct |
3179 ms |
283752 KB |
Output is correct |
4 |
Correct |
3246 ms |
283744 KB |
Output is correct |
5 |
Correct |
3453 ms |
283844 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3139 ms |
283896 KB |
Output is correct |
2 |
Correct |
3111 ms |
283704 KB |
Output is correct |
3 |
Correct |
3179 ms |
283752 KB |
Output is correct |
4 |
Correct |
3246 ms |
283744 KB |
Output is correct |
5 |
Correct |
3453 ms |
283844 KB |
Output is correct |
6 |
Incorrect |
3521 ms |
283576 KB |
Wrong Answer [6] |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Wrong Answer [1] |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3139 ms |
283896 KB |
Output is correct |
2 |
Correct |
3111 ms |
283704 KB |
Output is correct |
3 |
Correct |
3179 ms |
283752 KB |
Output is correct |
4 |
Correct |
3246 ms |
283744 KB |
Output is correct |
5 |
Correct |
3453 ms |
283844 KB |
Output is correct |
6 |
Incorrect |
3521 ms |
283576 KB |
Wrong Answer [6] |