제출 #1351501

#제출 시각아이디문제언어결과실행 시간메모리
1351501kasamchiCasino (JOI26_casino)C++20
100 / 100
243 ms844 KiB
#include "Azzurro.h"
#include <bits/stdc++.h>
using namespace std;

vector<vector<int>> Azzurro(int N, int L, string S) {
    vector<vector<int>> ret(N, vector<int>(N, 2));
    int idx = 0;
    ret[0][0] = idx < L ? S[idx++] - 'A' : 0;
    for (int i = 0; i <= 6; i++) {
        for (int j = 1; j <= 7; j++) {
            ret[i][j] = idx < L ? S[idx++] - 'A' : 0;
        }
    }
    ret[7][7] = idx < L ? S[idx++] - 'A' : 0;

    ret[1][0] = ret[7][6] = 1;
    for (int s = 2; s <= 12; s++) {
        int i = min(s, 7), j = s - i;
        ret[i][j] = 0;
        int x = i - 2, y = j + 2;
        while (x >= 0 && y <= 7) {
            ret[i][j] ^= ret[x][y];
            x -= 2, y += 2;
        }
    }
    return ret;
}
#include "Bordeaux.h"
#include <bits/stdc++.h>
using namespace std;

string Bordeaux(int N, int L, vector<vector<int>> T) {
    T[0][0] = !T[0][0];

    int x = 0, y = 0;
    if (T[1][0] == 1) {
        y = 1;
    } else {
        x = 1;
    }
    T[x][y] = !T[x][y];

    while (x + y <= 11) {
        array<pair<int, int>, 2> c = {make_pair(x + 1, y), make_pair(x, y + 1)};
        int i = min(x + y + 1, 7), j = x + y + 1 - i, s = 0;
        while (i >= 0 && j <= 7) {
            if (make_pair(i, j) == c[0]) {
                swap(c[0], c[1]);
            }
            s ^= T[i][j];
            i -= 2, j += 2;
        }
        x = c[s].first, y = c[s].second;
        T[x][y] = !T[x][y];
    }

    if (T[7][6] == 1) {
        x = 6, y = 7;
    } else {
        x = 7, y = 6;
    }
    T[x][y] = !T[x][y];

    T[7][7] = !T[7][7];

    int idx = 0;
    string S;
    if ((int)S.size() < L) S += T[0][0] + 'A';
    for (int i = 0; i <= 6; i++) {
        for (int j = 1; j <= 7; j++) {
            if ((int)S.size() < L) S += T[i][j] + 'A';
        }
    }
    if ((int)S.size() < L) S += T[7][7] + 'A';
    return S;
}
#Verdict Execution timeMemoryGrader output
Fetching results...