#include "lockpicking.h"
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define left ___left
#define right ___right
#define ALL(v) (v).begin(), (v).end()
#define REP(i, n) for (int _n = (n), i = 0; i < _n; ++i)
#define REPD(i, n) for (int i = (n); i-- > 0; )
#define FOR(i, a, b) for (int _b = (b), i = (a); i < _b; ++i)
#define FORD(i, b, a) for (int _a = (a), i = (b); i-- > _a; )
#define FORE(i, a, b) for (int _b = (b), i = (a); i <= _b; ++i)
#define FORDE(i, b, a) for (int _a = (a), i = (b); i >= _a; --i)
#define print_op(...) ostream & operator << (ostream &out, const __VA_ARGS__ &u)
template <class U, class V> print_op(pair <U, V>) { return out << '(' << u.fi << ", " << u.se << ')'; }
template <size_t i, class T> ostream & print_tuple_utils(ostream &out, const T &tup) {
if constexpr(i == tuple_size<T>::value) return out << ')';
else return print_tuple_utils <i + 1, T>(out << (!i ? "(" : ", ") << get<i>(tup), tup);
}
template <class ...T> print_op(tuple <T...>) { return print_tuple_utils <0, tuple <T...>> (out, u); }
template <class Con, class = decltype(begin(declval<Con>()))> typename enable_if <!is_same<Con, string>::value, ostream &>::type operator << (ostream &out, const Con &con) {
out << '{';
for (auto it = con.begin(); it != con.end(); ++it) out << (it == con.begin() ? "" : ", ") << *it;
return out << '}';
}
vector <string> vec_splitter(string s) {
s += ", ";
vector <string> res;
while (!s.empty()) {
size_t p = s.find(", ");
res.push_back(s.substr(0, p));
s = s.substr(p + 2);
}
return res;
}
template <class ...T> void debug_out(int line, vector <string> v, T&&... args) {
cerr << "L" << line << ": ";
int i = 0;
(..., (cerr << "[" << v[i++] << " = " << args << "]"));
cerr << '\n';
}
#define debug(...) debug_out(__LINE__, vec_splitter(#__VA_ARGS__), __VA_ARGS__)
void construct_card(int N, vector <int> A, vector <vector <int>> S) {
int M = 1;
vector B(N * N + 5, -1);
vector T(N * N + 5, vector(2, -1));
B[0] = A[0];
vector <int> visited(N);
REP(s, N) {
int i = s, j = 0;
int cnt = 0;
while (T[j][A[i]] != -1) {
int x = A[i], y = B[j];
i = S[i][y];
j = T[j][x];
if (++cnt == N) break;
}
if (cnt == N) continue;
int x = A[i], y = B[j];
i = S[i][y];
j = T[j][x] = M++;
fill(ALL(visited), -1);
REP(love, N) {
// while (visited[i] == -1) {
int x = A[i];
B[j] = x;
i = S[i][x];
visited[i] = j = T[j][x] = M++;
}
B[j] = A[i];
T[j][A[i]] = visited[S[i][A[i]]];
}
B.resize(M);
T.resize(M);
REP(i, M) {
REP(j, 2) if (T[i][j] == -1) T[i][j] = 0;
if (B[i] == -1) B[i] = 0;
}
define_states(M, B, T, 0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
ok, most errors: 1 (allowed: 1) |
2 |
Correct |
1 ms |
348 KB |
ok, most errors: 0 (allowed: 1) |
3 |
Correct |
0 ms |
348 KB |
ok, most errors: 0 (allowed: 1) |
4 |
Correct |
1 ms |
600 KB |
ok, most errors: 1 (allowed: 1) |
5 |
Correct |
0 ms |
436 KB |
ok, most errors: 1 (allowed: 1) |
6 |
Correct |
0 ms |
348 KB |
ok, most errors: 1 (allowed: 1) |
7 |
Correct |
0 ms |
348 KB |
ok, most errors: 1 (allowed: 1) |
8 |
Correct |
0 ms |
348 KB |
ok, most errors: 1 (allowed: 1) |
9 |
Correct |
0 ms |
432 KB |
ok, most errors: 1 (allowed: 1) |
10 |
Correct |
1 ms |
344 KB |
ok, most errors: 1 (allowed: 1) |
11 |
Correct |
1 ms |
344 KB |
ok, most errors: 1 (allowed: 1) |
12 |
Correct |
0 ms |
348 KB |
ok, most errors: 1 (allowed: 1) |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
ok, most errors: 3 (allowed: 29) |
2 |
Correct |
1 ms |
348 KB |
ok, most errors: 5 (allowed: 29) |
3 |
Correct |
1 ms |
348 KB |
ok, most errors: 4 (allowed: 29) |
4 |
Correct |
1 ms |
348 KB |
ok, most errors: 5 (allowed: 29) |
5 |
Correct |
1 ms |
348 KB |
ok, most errors: 4 (allowed: 29) |
6 |
Correct |
1 ms |
348 KB |
ok, most errors: 3 (allowed: 29) |
7 |
Correct |
1 ms |
348 KB |
ok, most errors: 4 (allowed: 29) |
8 |
Correct |
1 ms |
436 KB |
ok, most errors: 5 (allowed: 29) |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok, most errors: 3 (allowed: 899) |
2 |
Correct |
1 ms |
348 KB |
ok, most errors: 2 (allowed: 899) |
3 |
Correct |
1 ms |
344 KB |
ok, most errors: 4 (allowed: 899) |
4 |
Correct |
1 ms |
440 KB |
ok, most errors: 4 (allowed: 899) |
5 |
Correct |
1 ms |
348 KB |
ok, most errors: 4 (allowed: 899) |
6 |
Correct |
1 ms |
348 KB |
ok, most errors: 6 (allowed: 899) |
7 |
Correct |
1 ms |
348 KB |
ok, most errors: 3 (allowed: 899) |
8 |
Correct |
1 ms |
432 KB |
ok, most errors: 4 (allowed: 899) |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
ok, most errors: 1 (allowed: 1) |
2 |
Correct |
1 ms |
348 KB |
ok, most errors: 0 (allowed: 1) |
3 |
Correct |
0 ms |
348 KB |
ok, most errors: 0 (allowed: 1) |
4 |
Correct |
1 ms |
600 KB |
ok, most errors: 1 (allowed: 1) |
5 |
Correct |
0 ms |
436 KB |
ok, most errors: 1 (allowed: 1) |
6 |
Correct |
0 ms |
348 KB |
ok, most errors: 1 (allowed: 1) |
7 |
Correct |
0 ms |
348 KB |
ok, most errors: 1 (allowed: 1) |
8 |
Correct |
0 ms |
348 KB |
ok, most errors: 1 (allowed: 1) |
9 |
Correct |
0 ms |
432 KB |
ok, most errors: 1 (allowed: 1) |
10 |
Correct |
1 ms |
344 KB |
ok, most errors: 1 (allowed: 1) |
11 |
Correct |
1 ms |
344 KB |
ok, most errors: 1 (allowed: 1) |
12 |
Correct |
0 ms |
348 KB |
ok, most errors: 1 (allowed: 1) |
13 |
Correct |
1 ms |
348 KB |
ok, most errors: 3 (allowed: 29) |
14 |
Correct |
1 ms |
348 KB |
ok, most errors: 5 (allowed: 29) |
15 |
Correct |
1 ms |
348 KB |
ok, most errors: 4 (allowed: 29) |
16 |
Correct |
1 ms |
348 KB |
ok, most errors: 5 (allowed: 29) |
17 |
Correct |
1 ms |
348 KB |
ok, most errors: 4 (allowed: 29) |
18 |
Correct |
1 ms |
348 KB |
ok, most errors: 3 (allowed: 29) |
19 |
Correct |
1 ms |
348 KB |
ok, most errors: 4 (allowed: 29) |
20 |
Correct |
1 ms |
436 KB |
ok, most errors: 5 (allowed: 29) |
21 |
Correct |
3 ms |
1196 KB |
ok, most errors: 5 (allowed: 127) |
22 |
Correct |
4 ms |
1552 KB |
ok, most errors: 6 (allowed: 149) |
23 |
Correct |
4 ms |
1884 KB |
ok, most errors: 5 (allowed: 149) |
24 |
Correct |
4 ms |
1880 KB |
ok, most errors: 7 (allowed: 149) |
25 |
Correct |
6 ms |
3164 KB |
ok, most errors: 6 (allowed: 149) |
26 |
Correct |
6 ms |
3416 KB |
ok, most errors: 8 (allowed: 149) |
27 |
Correct |
6 ms |
2908 KB |
ok, most errors: 6 (allowed: 149) |
28 |
Correct |
6 ms |
3252 KB |
ok, most errors: 7 (allowed: 149) |
29 |
Correct |
6 ms |
3160 KB |
ok, most errors: 6 (allowed: 149) |
30 |
Correct |
6 ms |
3160 KB |
ok, most errors: 6 (allowed: 149) |
31 |
Correct |
6 ms |
3164 KB |
ok, most errors: 8 (allowed: 149) |
32 |
Correct |
7 ms |
3164 KB |
ok, most errors: 6 (allowed: 149) |