# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
282186 |
2020-08-24T06:04:29 Z |
송준혁(#5750) |
None (JOI15_memory) |
C++17 |
|
3082 ms |
283980 KB |
#include "Memory_lib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
int enc(int x, int y, int z, int t){
int m=t;
m = m * 51 + z;
m = m * 102 + y;
m = m * 102 + x;
return m;
}
void dec(int M, int &x, int &y, int &z, int &t){
x = M % 102, M /= 102;
y = M % 102, M /= 102;
z = M % 51, M /= 51;
t = M;
}
int Memory(int N, int M) {
int x, y, z, t;
dec(M, x, y, z, t);
if (M == 0) return enc(1, 1, 0, 0);
if (x < y || x < 1 || x > N+1 || y > N+1 || t > 2) return -2;
if (x == y){
if (x > N) return enc(x, N, 0, 0);
if (t){
char ch = Get(x);
if (ch == ']' && t == 2) return -2;
if (ch == '>' && t == 1) return -2;
return enc(x+1, x+1, 0, 0);
}
else{
char ch = Get(x);
if (ch == '[' || ch == '<') return enc(x+1, x+1, 0, 0);
return enc(x, x-1, 0, 0);
}
}
else{
if (y == 0){
if (x > N) return -1;
return -2;
}
char ch=Get(y);
if (ch == '[' || ch == '<'){
if (z) return enc(x, y-1, z-1, 0);
return enc(x, x, 0, (ch=='[')?1:2);
}
return enc(x, y-1, z+1, 0);
}
return -2;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3072 ms |
283804 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3072 ms |
283804 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3072 ms |
283804 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3072 ms |
283804 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3082 ms |
283980 KB |
Wrong Answer [5] |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3072 ms |
283804 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |