답안 #1088500

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1088500 2024-09-14T14:14:05 Z MateiKing80 Lockpicking (IOI23_lockpicking) C++17
100 / 100
20 ms 4352 KB
#include "lockpicking.h"
#include <bits/stdc++.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]] = c * N + s[j % N][b[j]];
            t[j][1 - b[j]] = -1;
        }
    }
    for(int i0 = 1; i0 < N; i0 ++)
    {
        int i = i0, j = 0;
        for (int cnt = 0; cnt < M; cnt ++)
        {
            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][b[j]];
                    t[j][a[i]] = i0 * N + nxti;
                    break;
                }
                else
                {
                    j = t[j][a[i]];
                    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);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB ok, most errors: 1 (allowed: 1)
2 Correct 0 ms 348 KB ok, most errors: 0 (allowed: 1)
3 Correct 0 ms 348 KB ok, most errors: 0 (allowed: 1)
4 Correct 0 ms 348 KB ok, most errors: 1 (allowed: 1)
5 Correct 0 ms 348 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 1 ms 348 KB ok, most errors: 1 (allowed: 1)
9 Correct 0 ms 348 KB ok, most errors: 1 (allowed: 1)
10 Correct 0 ms 348 KB ok, most errors: 1 (allowed: 1)
11 Correct 0 ms 348 KB ok, most errors: 1 (allowed: 1)
12 Correct 0 ms 348 KB ok, most errors: 1 (allowed: 1)
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB ok, most errors: 3 (allowed: 29)
2 Correct 0 ms 348 KB ok, most errors: 5 (allowed: 29)
3 Correct 1 ms 600 KB ok, most errors: 4 (allowed: 29)
4 Correct 1 ms 604 KB ok, most errors: 4 (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 600 KB ok, most errors: 4 (allowed: 29)
8 Correct 1 ms 344 KB ok, most errors: 5 (allowed: 29)
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB ok, most errors: 3 (allowed: 899)
2 Correct 1 ms 348 KB ok, most errors: 3 (allowed: 899)
3 Correct 1 ms 604 KB ok, most errors: 4 (allowed: 899)
4 Correct 1 ms 604 KB ok, most errors: 4 (allowed: 899)
5 Correct 1 ms 600 KB ok, most errors: 4 (allowed: 899)
6 Correct 1 ms 436 KB ok, most errors: 6 (allowed: 899)
7 Correct 1 ms 604 KB ok, most errors: 4 (allowed: 899)
8 Correct 0 ms 348 KB ok, most errors: 4 (allowed: 899)
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB ok, most errors: 1 (allowed: 1)
2 Correct 0 ms 348 KB ok, most errors: 0 (allowed: 1)
3 Correct 0 ms 348 KB ok, most errors: 0 (allowed: 1)
4 Correct 0 ms 348 KB ok, most errors: 1 (allowed: 1)
5 Correct 0 ms 348 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 1 ms 348 KB ok, most errors: 1 (allowed: 1)
9 Correct 0 ms 348 KB ok, most errors: 1 (allowed: 1)
10 Correct 0 ms 348 KB ok, most errors: 1 (allowed: 1)
11 Correct 0 ms 348 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 0 ms 348 KB ok, most errors: 5 (allowed: 29)
15 Correct 1 ms 600 KB ok, most errors: 4 (allowed: 29)
16 Correct 1 ms 604 KB ok, most errors: 4 (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 600 KB ok, most errors: 4 (allowed: 29)
20 Correct 1 ms 344 KB ok, most errors: 5 (allowed: 29)
21 Correct 14 ms 3164 KB ok, most errors: 6 (allowed: 127)
22 Correct 20 ms 4188 KB ok, most errors: 7 (allowed: 149)
23 Correct 16 ms 4188 KB ok, most errors: 5 (allowed: 149)
24 Correct 20 ms 4184 KB ok, most errors: 7 (allowed: 149)
25 Correct 12 ms 4188 KB ok, most errors: 6 (allowed: 149)
26 Correct 11 ms 4188 KB ok, most errors: 8 (allowed: 149)
27 Correct 17 ms 4184 KB ok, most errors: 6 (allowed: 149)
28 Correct 13 ms 4188 KB ok, most errors: 7 (allowed: 149)
29 Correct 12 ms 4352 KB ok, most errors: 6 (allowed: 149)
30 Correct 14 ms 4188 KB ok, most errors: 7 (allowed: 149)
31 Correct 12 ms 4188 KB ok, most errors: 8 (allowed: 149)
32 Correct 12 ms 4188 KB ok, most errors: 7 (allowed: 149)