제출 #839583

#제출 시각아이디문제언어결과실행 시간메모리
839583model_codeLockpicking (IOI23_lockpicking)C++17
30 / 100
14 ms5056 KiB
// 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...