Submission #946466

#TimeUsernameProblemLanguageResultExecution timeMemory
946466Nhoksocqt1Alice, Bob, and Circuit (APIO23_abc)C++17
4 / 100
122 ms23828 KiB
#ifndef Nhoksocqt1
    #include "abc.h"
#endif // Nhoksocqt1
#include<bits/stdc++.h>
using namespace std;

#define inf 0x3f3f3f3f
#define sz(x) int((x).size())
#define fi first
#define se second
#define names ajfhqwurhuqerw
typedef long long ll;
typedef pair<int, int> ii;

template<class X, class Y>
	inline bool maximize(X &x, const Y &y) {return (x < y ? x = y, 1 : 0);}
template<class X, class Y>
	inline bool minimize(X &x, const Y &y) {return (x > y ? x = y, 1 : 0);}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int Random(int l, int r) {
    return uniform_int_distribution<int>(l, r)(rng);
}

const int MAXN = 702;
const int MAXM = 1003;

string names[MAXN], letter[MAXM][2];
int n, m;

int alice(const int n, const char names[][5], const unsigned short numbers[], bool outputs_alice[]) {
    int lA(0);
    for (int j = 0; j < 16; ++j)
        outputs_alice[lA++] = (numbers[0] >> j & 1);

    outputs_alice[lA++] = 0;
    return lA;
    for (int i = 0; i < n; ++i) {
        bool check(0);
        for (int j = 0; j < 4; ++j) {
            int val = 26;
            if(!check)
                check |= (names[i][j] == '\0');

            if(!check)
                val = names[i][j] - 'a';

            for (int k = 4; k >= 0; --k)
                outputs_alice[lA++] = val >> k & 1;
        }

        for (int k = 15; k >= 0; --k)
            outputs_alice[lA++] = numbers[i] >> k & 1;
    }

    return lA;
}

int bob(const int m, const char send[][5], const char recei[][5], bool outputs_bob[]) {
    return m;
    int lB(0);
    for (int i = 0; i < m; ++i) {
        bool check(0);
        for (int j = 0; j < 4; ++j) {
            int val = 26;
            if(!check)
                check |= (send[i][j] == '\0');

            if(!check)
                val = send[i][j] - 'a';

            for (int k = 4; k >= 0; --k)
                outputs_bob[lB++] = val >> k & 1;
        }

        check = 0;
        for (int j = 0; j < 4; ++j) {
            int val = 26;
            if(!check)
                check |= (recei[i][j] == '\0');

            if(!check)
                val = recei[i][j] - 'a';

            for (int k = 4; k >= 0; --k)
                outputs_bob[lB++] = val >> k & 1;
        }
    }

    return lB;
}

int circuit(const int la, const int lb, int ope[], int gate[][2], int outputs_circuit[][16]) {
    int l(la + lb);
    for (int j = 0; j < 16; ++j) {
        ope[l] = 8;
        gate[l][0] = gate[l][1] = 16;
        ++l;
    }

    for (int t = 0; t < lb; ++t) {
        for (int j = 0; j < 16; ++j) {
            ope[l] = 8;
            gate[l][0] = gate[l][1] = j;
            ++l;
        }

        for (int j = 0; j < 16; ++j) {
            for (int t = 0; t < 16; ++t) {
                ope[l] = 6;
                gate[l][0] = l - 32, gate[l][1] = l - 16;
                ++l;
            }

            ope[l] = 8;
            gate[l][0] = gate[l][1] = 16;
            ++l;

            for (int t = 1; t < 16; ++t) {
                ope[l] = 8;
                gate[l][0] = l - 33, gate[l][1] = l - 17;
                ++l;
            }
        }

        for (int j = 0; j < 16; ++j) {
            ope[l] = 14;
            gate[l][0] = l - 32, gate[l][1] = l - 16;
            ++l;
        }
    }

    for (int i = 0; i < 16; ++i)
        outputs_circuit[0][i] = l - 16 + i;

    return l;
}

#ifdef Nhoksocqt1

bool alice_output[100 * MAXM], bob_output[100 * MAXM], circuit_output[MAXN][16];

int main(void) {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    #define TASK "abc"
    if(fopen(TASK".inp", "r")) {
        freopen(TASK".inp", "r", stdin);
        freopen(TASK".out", "w", stdout);
    }

    int numbers[MAXN];
    char names[MAXN][5];
    char send[MAXM][5], reic[MAXM][5];
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; ++i) {
        string str;
        cin >> str;
        for (int j = 0; j < sz(str); ++j)
            names[i][j] = str[j];

        names[i][sz(str)] = '\0';
        cin >> numbers[i];
    }

    for (int i = 0; i < m; ++i) {
        string sa, sb;
        cin >> sa >> sb;
        for (int j = 0; j < sz(sa); ++j)
            send[i][j] = sa[j];

        for (int j = 0; j < sz(sb); ++j)
            reic[i][j] = sb[j];

        send[i][sz(sa)] = reic[i][sz(sb)] = '\0';
    }

    return 0;
}

#endif // Nhoksocqt1
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...