답안 #594806

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
594806 2022-07-12T23:47:55 Z Ozy 화성 (APIO22_mars) C++17
29 / 100
135 ms 2928 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 debug(a) cout << #a << " = " << a << endl
#define debugsl(a) cout << #a << " = " << a << ", "

#define inicio "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"

vector <std::vector<std::string>> A;
lli arr[22][22],visitados[22][22];
lli res;

void llena(string mapa, lli fil, lli col) {
    lli i,j;

    rep(act,0,99) {
        i = act/10;
        i *= 2;
        i += 1+fil;

        j = act%10;
        j *= 2;
        j += 1+col;

        if (mapa[act] == '1') arr[i][j] = 1;
    }

}

void marca(lli fil, lli col) {
    lli x,y;

    visitados[fil][col] = 1;

    x = fil+1;
    y = col;
    if (arr[x][y] == 1 && visitados[x][y] == 0) marca(x,y);
    x = fil-1;
    y = col;
    if (arr[x][y] == 1 && visitados[x][y] == 0) marca(x,y);
    x = fil;
    y = col+1;
    if (arr[x][y] == 1 && visitados[x][y] == 0) marca(x,y);
    x = fil;
    y = col-1;
    if (arr[x][y] == 1 && visitados[x][y] == 0) marca(x,y);

}

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 = 10;

    if (k == 0) {
        rep(x,0,2) {
            rep(y,0,2) {

                lli I = (i+x)/2;
                lli J = (j+y)/2;
                pos = I*largo + J;
                if (A[x][y][pos] == '0') A[x][y][pos] = A[x][y][0];

                if (pos != 0) A[x][y][0] = '0';
            }
        }
    }

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

    if (k < n-1) return st;

    rep(x,0,21) {
        rep(y,0,21) {
            arr[x][y] = 0;
            visitados[x][y] = 0;
        }
    }

    A[0][0] = st;
    rep(q,0,99) A[0][1][q] = A[0][1][q] | A[2][1][q];
    rep(q,0,99) A[1][0][q] = A[1][0][q] | A[1][2][q];

    llena(A[0][0],0,0);
    llena(A[0][1],0,1);
    llena(A[1][0],1,0);
    llena(A[1][1],1,1);

    res = 0;
    rep(x,1,20) {
        rep(y,1,20) {
            if (visitados[x][y] == 1) continue;
            if (arr[x][y] == 1) {
                res++;
                marca(x,y);
            }
        }
    }

    //rep(x,1,20) {
    //    rep(y,1,20) {
    //        cout << arr[x][y];
    //    }
    //    cout << endl;
    //}

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

    return fin;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 2320 KB Output is correct
2 Correct 8 ms 2164 KB Output is correct
3 Correct 7 ms 2184 KB Output is correct
4 Correct 7 ms 2204 KB Output is correct
5 Correct 8 ms 2228 KB Output is correct
6 Correct 8 ms 2100 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 2320 KB Output is correct
2 Correct 8 ms 2164 KB Output is correct
3 Correct 7 ms 2184 KB Output is correct
4 Correct 7 ms 2204 KB Output is correct
5 Correct 8 ms 2228 KB Output is correct
6 Correct 8 ms 2100 KB Output is correct
7 Correct 10 ms 2252 KB Output is correct
8 Correct 16 ms 2212 KB Output is correct
9 Correct 16 ms 2316 KB Output is correct
10 Correct 17 ms 2216 KB Output is correct
11 Correct 17 ms 2192 KB Output is correct
12 Correct 16 ms 2300 KB Output is correct
13 Correct 17 ms 2216 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 2320 KB Output is correct
2 Correct 8 ms 2164 KB Output is correct
3 Correct 7 ms 2184 KB Output is correct
4 Correct 7 ms 2204 KB Output is correct
5 Correct 8 ms 2228 KB Output is correct
6 Correct 8 ms 2100 KB Output is correct
7 Correct 10 ms 2252 KB Output is correct
8 Correct 16 ms 2212 KB Output is correct
9 Correct 16 ms 2316 KB Output is correct
10 Correct 17 ms 2216 KB Output is correct
11 Correct 17 ms 2192 KB Output is correct
12 Correct 16 ms 2300 KB Output is correct
13 Correct 17 ms 2216 KB Output is correct
14 Correct 31 ms 2452 KB Output is correct
15 Correct 44 ms 2580 KB Output is correct
16 Correct 45 ms 2704 KB Output is correct
17 Correct 43 ms 2568 KB Output is correct
18 Correct 41 ms 2548 KB Output is correct
19 Correct 44 ms 2648 KB Output is correct
20 Correct 46 ms 2648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 2320 KB Output is correct
2 Correct 8 ms 2164 KB Output is correct
3 Correct 7 ms 2184 KB Output is correct
4 Correct 7 ms 2204 KB Output is correct
5 Correct 8 ms 2228 KB Output is correct
6 Correct 8 ms 2100 KB Output is correct
7 Correct 10 ms 2252 KB Output is correct
8 Correct 16 ms 2212 KB Output is correct
9 Correct 16 ms 2316 KB Output is correct
10 Correct 17 ms 2216 KB Output is correct
11 Correct 17 ms 2192 KB Output is correct
12 Correct 16 ms 2300 KB Output is correct
13 Correct 17 ms 2216 KB Output is correct
14 Correct 31 ms 2452 KB Output is correct
15 Correct 44 ms 2580 KB Output is correct
16 Correct 45 ms 2704 KB Output is correct
17 Correct 43 ms 2568 KB Output is correct
18 Correct 41 ms 2548 KB Output is correct
19 Correct 44 ms 2648 KB Output is correct
20 Correct 46 ms 2648 KB Output is correct
21 Correct 63 ms 2588 KB Output is correct
22 Correct 97 ms 2928 KB Output is correct
23 Correct 89 ms 2680 KB Output is correct
24 Correct 86 ms 2732 KB Output is correct
25 Correct 87 ms 2780 KB Output is correct
26 Correct 105 ms 2832 KB Output is correct
27 Correct 84 ms 2748 KB Output is correct
28 Correct 90 ms 2724 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 2320 KB Output is correct
2 Correct 8 ms 2164 KB Output is correct
3 Correct 7 ms 2184 KB Output is correct
4 Correct 7 ms 2204 KB Output is correct
5 Correct 8 ms 2228 KB Output is correct
6 Correct 8 ms 2100 KB Output is correct
7 Correct 10 ms 2252 KB Output is correct
8 Correct 16 ms 2212 KB Output is correct
9 Correct 16 ms 2316 KB Output is correct
10 Correct 17 ms 2216 KB Output is correct
11 Correct 17 ms 2192 KB Output is correct
12 Correct 16 ms 2300 KB Output is correct
13 Correct 17 ms 2216 KB Output is correct
14 Correct 31 ms 2452 KB Output is correct
15 Correct 44 ms 2580 KB Output is correct
16 Correct 45 ms 2704 KB Output is correct
17 Correct 43 ms 2568 KB Output is correct
18 Correct 41 ms 2548 KB Output is correct
19 Correct 44 ms 2648 KB Output is correct
20 Correct 46 ms 2648 KB Output is correct
21 Correct 63 ms 2588 KB Output is correct
22 Correct 97 ms 2928 KB Output is correct
23 Correct 89 ms 2680 KB Output is correct
24 Correct 86 ms 2732 KB Output is correct
25 Correct 87 ms 2780 KB Output is correct
26 Correct 105 ms 2832 KB Output is correct
27 Correct 84 ms 2748 KB Output is correct
28 Correct 90 ms 2724 KB Output is correct
29 Correct 135 ms 2764 KB Output is correct
30 Incorrect 21 ms 352 KB Incorrect
31 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 2320 KB Output is correct
2 Correct 8 ms 2164 KB Output is correct
3 Correct 7 ms 2184 KB Output is correct
4 Correct 7 ms 2204 KB Output is correct
5 Correct 8 ms 2228 KB Output is correct
6 Correct 8 ms 2100 KB Output is correct
7 Correct 10 ms 2252 KB Output is correct
8 Correct 16 ms 2212 KB Output is correct
9 Correct 16 ms 2316 KB Output is correct
10 Correct 17 ms 2216 KB Output is correct
11 Correct 17 ms 2192 KB Output is correct
12 Correct 16 ms 2300 KB Output is correct
13 Correct 17 ms 2216 KB Output is correct
14 Correct 31 ms 2452 KB Output is correct
15 Correct 44 ms 2580 KB Output is correct
16 Correct 45 ms 2704 KB Output is correct
17 Correct 43 ms 2568 KB Output is correct
18 Correct 41 ms 2548 KB Output is correct
19 Correct 44 ms 2648 KB Output is correct
20 Correct 46 ms 2648 KB Output is correct
21 Correct 63 ms 2588 KB Output is correct
22 Correct 97 ms 2928 KB Output is correct
23 Correct 89 ms 2680 KB Output is correct
24 Correct 86 ms 2732 KB Output is correct
25 Correct 87 ms 2780 KB Output is correct
26 Correct 105 ms 2832 KB Output is correct
27 Correct 84 ms 2748 KB Output is correct
28 Correct 90 ms 2724 KB Output is correct
29 Correct 135 ms 2764 KB Output is correct
30 Incorrect 21 ms 352 KB Incorrect
31 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 2320 KB Output is correct
2 Correct 8 ms 2164 KB Output is correct
3 Correct 7 ms 2184 KB Output is correct
4 Correct 7 ms 2204 KB Output is correct
5 Correct 8 ms 2228 KB Output is correct
6 Correct 8 ms 2100 KB Output is correct
7 Correct 10 ms 2252 KB Output is correct
8 Correct 16 ms 2212 KB Output is correct
9 Correct 16 ms 2316 KB Output is correct
10 Correct 17 ms 2216 KB Output is correct
11 Correct 17 ms 2192 KB Output is correct
12 Correct 16 ms 2300 KB Output is correct
13 Correct 17 ms 2216 KB Output is correct
14 Correct 31 ms 2452 KB Output is correct
15 Correct 44 ms 2580 KB Output is correct
16 Correct 45 ms 2704 KB Output is correct
17 Correct 43 ms 2568 KB Output is correct
18 Correct 41 ms 2548 KB Output is correct
19 Correct 44 ms 2648 KB Output is correct
20 Correct 46 ms 2648 KB Output is correct
21 Correct 63 ms 2588 KB Output is correct
22 Correct 97 ms 2928 KB Output is correct
23 Correct 89 ms 2680 KB Output is correct
24 Correct 86 ms 2732 KB Output is correct
25 Correct 87 ms 2780 KB Output is correct
26 Correct 105 ms 2832 KB Output is correct
27 Correct 84 ms 2748 KB Output is correct
28 Correct 90 ms 2724 KB Output is correct
29 Correct 135 ms 2764 KB Output is correct
30 Incorrect 21 ms 352 KB Incorrect
31 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 2320 KB Output is correct
2 Correct 8 ms 2164 KB Output is correct
3 Correct 7 ms 2184 KB Output is correct
4 Correct 7 ms 2204 KB Output is correct
5 Correct 8 ms 2228 KB Output is correct
6 Correct 8 ms 2100 KB Output is correct
7 Correct 10 ms 2252 KB Output is correct
8 Correct 16 ms 2212 KB Output is correct
9 Correct 16 ms 2316 KB Output is correct
10 Correct 17 ms 2216 KB Output is correct
11 Correct 17 ms 2192 KB Output is correct
12 Correct 16 ms 2300 KB Output is correct
13 Correct 17 ms 2216 KB Output is correct
14 Correct 31 ms 2452 KB Output is correct
15 Correct 44 ms 2580 KB Output is correct
16 Correct 45 ms 2704 KB Output is correct
17 Correct 43 ms 2568 KB Output is correct
18 Correct 41 ms 2548 KB Output is correct
19 Correct 44 ms 2648 KB Output is correct
20 Correct 46 ms 2648 KB Output is correct
21 Correct 63 ms 2588 KB Output is correct
22 Correct 97 ms 2928 KB Output is correct
23 Correct 89 ms 2680 KB Output is correct
24 Correct 86 ms 2732 KB Output is correct
25 Correct 87 ms 2780 KB Output is correct
26 Correct 105 ms 2832 KB Output is correct
27 Correct 84 ms 2748 KB Output is correct
28 Correct 90 ms 2724 KB Output is correct
29 Correct 135 ms 2764 KB Output is correct
30 Incorrect 21 ms 352 KB Incorrect
31 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 2320 KB Output is correct
2 Correct 8 ms 2164 KB Output is correct
3 Correct 7 ms 2184 KB Output is correct
4 Correct 7 ms 2204 KB Output is correct
5 Correct 8 ms 2228 KB Output is correct
6 Correct 8 ms 2100 KB Output is correct
7 Correct 10 ms 2252 KB Output is correct
8 Correct 16 ms 2212 KB Output is correct
9 Correct 16 ms 2316 KB Output is correct
10 Correct 17 ms 2216 KB Output is correct
11 Correct 17 ms 2192 KB Output is correct
12 Correct 16 ms 2300 KB Output is correct
13 Correct 17 ms 2216 KB Output is correct
14 Correct 31 ms 2452 KB Output is correct
15 Correct 44 ms 2580 KB Output is correct
16 Correct 45 ms 2704 KB Output is correct
17 Correct 43 ms 2568 KB Output is correct
18 Correct 41 ms 2548 KB Output is correct
19 Correct 44 ms 2648 KB Output is correct
20 Correct 46 ms 2648 KB Output is correct
21 Correct 63 ms 2588 KB Output is correct
22 Correct 97 ms 2928 KB Output is correct
23 Correct 89 ms 2680 KB Output is correct
24 Correct 86 ms 2732 KB Output is correct
25 Correct 87 ms 2780 KB Output is correct
26 Correct 105 ms 2832 KB Output is correct
27 Correct 84 ms 2748 KB Output is correct
28 Correct 90 ms 2724 KB Output is correct
29 Correct 135 ms 2764 KB Output is correct
30 Incorrect 21 ms 352 KB Incorrect
31 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 2320 KB Output is correct
2 Correct 8 ms 2164 KB Output is correct
3 Correct 7 ms 2184 KB Output is correct
4 Correct 7 ms 2204 KB Output is correct
5 Correct 8 ms 2228 KB Output is correct
6 Correct 8 ms 2100 KB Output is correct
7 Correct 10 ms 2252 KB Output is correct
8 Correct 16 ms 2212 KB Output is correct
9 Correct 16 ms 2316 KB Output is correct
10 Correct 17 ms 2216 KB Output is correct
11 Correct 17 ms 2192 KB Output is correct
12 Correct 16 ms 2300 KB Output is correct
13 Correct 17 ms 2216 KB Output is correct
14 Correct 31 ms 2452 KB Output is correct
15 Correct 44 ms 2580 KB Output is correct
16 Correct 45 ms 2704 KB Output is correct
17 Correct 43 ms 2568 KB Output is correct
18 Correct 41 ms 2548 KB Output is correct
19 Correct 44 ms 2648 KB Output is correct
20 Correct 46 ms 2648 KB Output is correct
21 Correct 63 ms 2588 KB Output is correct
22 Correct 97 ms 2928 KB Output is correct
23 Correct 89 ms 2680 KB Output is correct
24 Correct 86 ms 2732 KB Output is correct
25 Correct 87 ms 2780 KB Output is correct
26 Correct 105 ms 2832 KB Output is correct
27 Correct 84 ms 2748 KB Output is correct
28 Correct 90 ms 2724 KB Output is correct
29 Correct 135 ms 2764 KB Output is correct
30 Incorrect 21 ms 352 KB Incorrect
31 Halted 0 ms 0 KB -