This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// correct/subtask2.cpp
#include "lockpicking.h"
using namespace std;
int M;
vector<int> a, b;
vector<vector<int>> s, t;
void construct_card(int N, std::vector<int> A, std::vector<std::vector<int>> S) {
a = A, s = S;
M = N*N;
b.resize(N*M);
t.assign(N*M, vector<int>(2));
for (int c=0; c<N; ++c) {
int i = c;
vector<int> last(N);
for (int j=c*M; j<(c+1)*M; ++j) {
b[j] = a[i];
t[j][a[i]] = j+1;
t[j][1-a[i]] = (c+1<N ? j+M+1 : j+1);
last[i] = j;
i = s[i][a[i]];
}
t[c*M+M-1][0] = t[c*M+M-1][1] = last[i];
}
define_states(N*M, b, t, 0);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |