# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
56893 |
2018-07-13T05:47:46 Z |
윤교준(#1636) |
None (JOI15_memory) |
C++11 |
|
6000 ms |
276896 KB |
#include "Memory_lib.h"
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define sz(V) ((int)(V).size())
using namespace std;
int Memory(int N, int M) {
if(N&1) return -2;
if(N <= 30) {
int L = M & ((1<<5)-1);
int key = M >> 5;
int kl = 0;
for(; (1<<(kl+1))-2 < key; kl++);
if(N < L || L < kl) return -2;
vector<int> V;
key -= ((1<<kl)-1);
for(int i = 0; i < kl; i++)
V.eb((key & (1<<i)) ? 1 : 0);
if(L == N)
return kl ? -2 : -1;
switch(Get(L+1)) {
case '<':
V.eb(1);
break;
case '[':
V.eb(0);
break;
case '>':
if(V.empty() || !V.back())
return -2;
V.pop_back();
break;
case ']':
if(V.empty() || V.back())
return -2;
V.pop_back();
break;
}
if(N/2 < sz(V)) return -2;
key = 0; kl = sz(V);
for(int i = 0; i < kl; i++)
if(V[i]) key |= 1<<i;
key += (1<<kl)-1;
L++;
return (key << 5) | L;
} else {
int L = M & ((1<<7)-1);
int key = M >> 7;
if(L == N) return key ? -2 : -1;
key += ('<' == Get(L+1) ? 1 : -1);
if(key < 0) return -2;
L++;
return (key << 7) | L;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2942 ms |
276780 KB |
Output is correct |
2 |
Correct |
4257 ms |
276780 KB |
Output is correct |
3 |
Correct |
3505 ms |
276848 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2942 ms |
276780 KB |
Output is correct |
2 |
Correct |
4257 ms |
276780 KB |
Output is correct |
3 |
Correct |
3505 ms |
276848 KB |
Output is correct |
4 |
Correct |
3475 ms |
276896 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2942 ms |
276780 KB |
Output is correct |
2 |
Correct |
4257 ms |
276780 KB |
Output is correct |
3 |
Correct |
3505 ms |
276848 KB |
Output is correct |
4 |
Correct |
3475 ms |
276896 KB |
Output is correct |
5 |
Correct |
5563 ms |
276896 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2942 ms |
276780 KB |
Output is correct |
2 |
Correct |
4257 ms |
276780 KB |
Output is correct |
3 |
Correct |
3505 ms |
276848 KB |
Output is correct |
4 |
Correct |
3475 ms |
276896 KB |
Output is correct |
5 |
Correct |
5563 ms |
276896 KB |
Output is correct |
6 |
Execution timed out |
6072 ms |
276896 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
36 ms |
276896 KB |
Wrong Answer [3] |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2942 ms |
276780 KB |
Output is correct |
2 |
Correct |
4257 ms |
276780 KB |
Output is correct |
3 |
Correct |
3505 ms |
276848 KB |
Output is correct |
4 |
Correct |
3475 ms |
276896 KB |
Output is correct |
5 |
Correct |
5563 ms |
276896 KB |
Output is correct |
6 |
Execution timed out |
6072 ms |
276896 KB |
Time limit exceeded |