Submission #594605

# Submission time Handle Problem Language Result Execution time Memory
594605 2022-07-12T17:44:52 Z Ozy Mars (APIO22_mars) C++17
0 / 100
1 ms 388 KB
#include "mars.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define repa(i,a,b) for (int i = (a); i >= (b); i--)
#define lli long long int

#define inicio "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"

vector <std::vector<std::string>> A;

std::string process(std::vector <std::vector<std::string>> a, int i, int j, int k, int n)
{

    swap(A,a);
    string st = inicio;
    lli pos,largo;
    largo = 2*n + 1;

    if (k == 0) {
        rep(x,0,2) {
            rep(y,0,2) {
                pos = (x+i)*largo + (j+y) + 1;
                A[x][y][pos] = A[x][y][0];
            }
        }
    }

    rep(x,0,2) {
        rep(y,0,2) {

            rep(q,0,99) if (A[x][y][q] == '1') st[q] = '1';

        }
    }

    if (k < n-1) return st;

    lli act,nue,res = 0;
    queue<lli> cola;
    lli visitados[200];
    rep(q,1,n) visitados[q] = 0;

    rep(i,1,99) {
        if (visitados[i] == 1) continue;
        if (st[i] == '1') {

            res++;
            cola.push(i);

            while (!cola.empty()) {
                act = cola.front();
                cola.pop();

                if (visitados[act] == 1) continue;
                visitados[act] = 1;

                nue = act+1;
                if (act%largo != 0) if (st[nue] == '1') cola.push(nue);

                nue = act-1;
                if (nue%largo != 0) if (st[nue] == '1')cola.push(nue);

                nue = act+largo;
                if (nue <= (largo*largo)) if (st[nue] == '1') cola.push(nue);

                nue = act-largo;
                if (nue > 0) if (st[nue] == '1') cola.push(nue);
            }

        }
    }

    string fin = inicio;
    lli cont = 0;
    while (res > 0) {
        if (res&1) fin[cont] = '1';
        res /= 2;
        cont++;
    }

    return fin;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 388 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 388 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 388 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 388 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 388 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 388 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 388 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 388 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 388 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 388 KB Incorrect
2 Halted 0 ms 0 KB -