Submission #839584

# Submission time Handle Problem Language Result Execution time Memory
839584 2023-08-30T09:00:24 Z model_code Lockpicking (IOI23_lockpicking) C++17
21 / 100
1 ms 340 KB
// incorrect/wa1.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(M);
    t.assign(M, vector<int>(2));
    for (int c=0; c<N; ++c) {
        for (int j=c*N; j<(c+1)*N; ++j) {
            b[j] = a[j%N];
            t[j][b[j]] = s[j%N][b[j]];
            t[j][1-b[j]] = -1;
        }
    }
    for (int i0=1; i0<N; ++i0) {
        int i = i0, j = 0;
        vector<bool> vis(M, false);
        while (!vis[j]) {
            vis[j] = true;
            if (b[j] == a[i]) {
                j = t[j][b[j]];
                i = s[i][a[i]];
            }
            else {
                if (t[j][a[i]] == -1) {
                    int nxti = s[i][1-a[i]];
                    t[j][a[i]] = i0*N + nxti;
                    break;
                }
                else {
                    j = t[j][1-b[j]];
                    i = s[i][1-a[i]];
                }
            }
        }
    }
    for (int j=0; j<M; ++j) {
        t[j][0] = max(0, t[j][0]);
        t[j][1] = max(0, t[j][1]);
    }
    
	define_states(M, b, t, 0);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB ok, most errors: 1 (allowed: 1)
2 Correct 0 ms 212 KB ok, most errors: 0 (allowed: 1)
3 Correct 1 ms 212 KB ok, most errors: 0 (allowed: 1)
4 Correct 0 ms 212 KB ok, most errors: 1 (allowed: 1)
5 Correct 1 ms 212 KB ok, most errors: 1 (allowed: 1)
6 Correct 0 ms 288 KB ok, most errors: 1 (allowed: 1)
7 Correct 0 ms 212 KB ok, most errors: 1 (allowed: 1)
8 Correct 0 ms 212 KB ok, most errors: 1 (allowed: 1)
9 Correct 0 ms 212 KB ok, most errors: 1 (allowed: 1)
10 Correct 1 ms 212 KB ok, most errors: 1 (allowed: 1)
11 Correct 1 ms 212 KB ok, most errors: 1 (allowed: 1)
12 Correct 0 ms 212 KB ok, most errors: 1 (allowed: 1)
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB ok, most errors: 3 (allowed: 29)
2 Incorrect 1 ms 340 KB failed to open the lock
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB ok, most errors: 3 (allowed: 899)
2 Incorrect 1 ms 340 KB failed to open the lock
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB ok, most errors: 1 (allowed: 1)
2 Correct 0 ms 212 KB ok, most errors: 0 (allowed: 1)
3 Correct 1 ms 212 KB ok, most errors: 0 (allowed: 1)
4 Correct 0 ms 212 KB ok, most errors: 1 (allowed: 1)
5 Correct 1 ms 212 KB ok, most errors: 1 (allowed: 1)
6 Correct 0 ms 288 KB ok, most errors: 1 (allowed: 1)
7 Correct 0 ms 212 KB ok, most errors: 1 (allowed: 1)
8 Correct 0 ms 212 KB ok, most errors: 1 (allowed: 1)
9 Correct 0 ms 212 KB ok, most errors: 1 (allowed: 1)
10 Correct 1 ms 212 KB ok, most errors: 1 (allowed: 1)
11 Correct 1 ms 212 KB ok, most errors: 1 (allowed: 1)
12 Correct 0 ms 212 KB ok, most errors: 1 (allowed: 1)
13 Correct 0 ms 340 KB ok, most errors: 3 (allowed: 29)
14 Incorrect 1 ms 340 KB failed to open the lock
15 Halted 0 ms 0 KB -