# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
595770 |
2022-07-14T06:21:25 Z |
maomao90 |
None (JOI15_memory) |
C++17 |
|
1 ms |
212 KB |
#include "Memory_lib.h"
#include <bits/stdc++.h>
using namespace std;
#define REP(i, j, k) for (int i = j; i < k; i++)
#define RREP(i, j, k) for (int i = j; i >= k; i--)
template <class T>
bool inline mnto(T &a, const T b) {return a > b ? a = b, 1 : 0;}
template <class T>
bool inline mxto(T &a, const T b) {return a < b ? a = b, 1 : 0;}
typedef long long ll;
#define FI first
#define SE second
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int) x.size()
#define pb push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> vll;
typedef tuple<int, int, int> iii;
#ifndef DEBUG
#define cerr if (0) cerr
#endif
const int MAXN = 100;
const int INF = 1000000005;
const ll LINF = 1000000000000000005;
inline bool isop(char c) {
return c == '[' || c == '<';
}
inline int getno(char c) {
if (c == '[' || c == ']') {
return 1;
} else {
return 2;
}
}
inline vi itov(int m) {
vi res(4, 0);
res[0] = m % MAXN;
m /= MAXN;
res[1] = m % MAXN;
m /= MAXN;
res[2] = m % MAXN;
m /= MAXN;
res[3] = m;
return res;
}
inline int vtoi(vi v) {
int res = 0;
RREP (i, 3, 0) {
res *= MAXN;
res += v[i];
}
return res;
}
int Memory(int n, int m) {
vi cur = itov(m);
char c = Get(cur[1] + 1);
cerr << cur[0] << ' ' << cur[1] << ' ' << cur[2] << ' ' << cur[3] << ' ' << c << '\n';
if (cur[2] == cur[0] && isop(c)) {
if (cur[3] != 0) {
return -2;
}
cur[3] = getno(c);
} else if (cur[2] - 1 == cur[0] && !isop(c)) {
if (cur[3] != getno(c)) {
return -2;
}
cur[3] = 0;
}
cur[2] += isop(c) ? 1 : -1;
if (cur[2] < 0) {
return -2;
}
if (cur[1] < n - 1) {
cur[1]++;
} else {
if (cur[2] != 0) {
return -2;
}
if (cur[0] == n - 1) {
return -1;
}
cur[0]++;
cur[1] = 0;
cur[2] = 0;
cur[3] = 0;
}
return vtoi(cur);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |