답안 #594805

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
594805 2022-07-12T23:47:32 Z Ozy 화성 (APIO22_mars) C++17
29 / 100
126 ms 3048 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 8 ms 1980 KB Output is correct
2 Correct 8 ms 2228 KB Output is correct
3 Correct 8 ms 2216 KB Output is correct
4 Correct 8 ms 2336 KB Output is correct
5 Correct 8 ms 2204 KB Output is correct
6 Correct 8 ms 2104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1980 KB Output is correct
2 Correct 8 ms 2228 KB Output is correct
3 Correct 8 ms 2216 KB Output is correct
4 Correct 8 ms 2336 KB Output is correct
5 Correct 8 ms 2204 KB Output is correct
6 Correct 8 ms 2104 KB Output is correct
7 Correct 11 ms 2244 KB Output is correct
8 Correct 16 ms 2488 KB Output is correct
9 Correct 16 ms 2224 KB Output is correct
10 Correct 16 ms 2464 KB Output is correct
11 Correct 16 ms 2404 KB Output is correct
12 Correct 15 ms 2316 KB Output is correct
13 Correct 17 ms 2448 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1980 KB Output is correct
2 Correct 8 ms 2228 KB Output is correct
3 Correct 8 ms 2216 KB Output is correct
4 Correct 8 ms 2336 KB Output is correct
5 Correct 8 ms 2204 KB Output is correct
6 Correct 8 ms 2104 KB Output is correct
7 Correct 11 ms 2244 KB Output is correct
8 Correct 16 ms 2488 KB Output is correct
9 Correct 16 ms 2224 KB Output is correct
10 Correct 16 ms 2464 KB Output is correct
11 Correct 16 ms 2404 KB Output is correct
12 Correct 15 ms 2316 KB Output is correct
13 Correct 17 ms 2448 KB Output is correct
14 Correct 27 ms 2528 KB Output is correct
15 Correct 40 ms 2612 KB Output is correct
16 Correct 40 ms 2556 KB Output is correct
17 Correct 43 ms 2644 KB Output is correct
18 Correct 44 ms 2516 KB Output is correct
19 Correct 41 ms 2620 KB Output is correct
20 Correct 43 ms 2532 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1980 KB Output is correct
2 Correct 8 ms 2228 KB Output is correct
3 Correct 8 ms 2216 KB Output is correct
4 Correct 8 ms 2336 KB Output is correct
5 Correct 8 ms 2204 KB Output is correct
6 Correct 8 ms 2104 KB Output is correct
7 Correct 11 ms 2244 KB Output is correct
8 Correct 16 ms 2488 KB Output is correct
9 Correct 16 ms 2224 KB Output is correct
10 Correct 16 ms 2464 KB Output is correct
11 Correct 16 ms 2404 KB Output is correct
12 Correct 15 ms 2316 KB Output is correct
13 Correct 17 ms 2448 KB Output is correct
14 Correct 27 ms 2528 KB Output is correct
15 Correct 40 ms 2612 KB Output is correct
16 Correct 40 ms 2556 KB Output is correct
17 Correct 43 ms 2644 KB Output is correct
18 Correct 44 ms 2516 KB Output is correct
19 Correct 41 ms 2620 KB Output is correct
20 Correct 43 ms 2532 KB Output is correct
21 Correct 68 ms 2576 KB Output is correct
22 Correct 92 ms 3040 KB Output is correct
23 Correct 91 ms 2720 KB Output is correct
24 Correct 94 ms 2804 KB Output is correct
25 Correct 95 ms 3048 KB Output is correct
26 Correct 92 ms 2752 KB Output is correct
27 Correct 96 ms 2732 KB Output is correct
28 Correct 86 ms 2688 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1980 KB Output is correct
2 Correct 8 ms 2228 KB Output is correct
3 Correct 8 ms 2216 KB Output is correct
4 Correct 8 ms 2336 KB Output is correct
5 Correct 8 ms 2204 KB Output is correct
6 Correct 8 ms 2104 KB Output is correct
7 Correct 11 ms 2244 KB Output is correct
8 Correct 16 ms 2488 KB Output is correct
9 Correct 16 ms 2224 KB Output is correct
10 Correct 16 ms 2464 KB Output is correct
11 Correct 16 ms 2404 KB Output is correct
12 Correct 15 ms 2316 KB Output is correct
13 Correct 17 ms 2448 KB Output is correct
14 Correct 27 ms 2528 KB Output is correct
15 Correct 40 ms 2612 KB Output is correct
16 Correct 40 ms 2556 KB Output is correct
17 Correct 43 ms 2644 KB Output is correct
18 Correct 44 ms 2516 KB Output is correct
19 Correct 41 ms 2620 KB Output is correct
20 Correct 43 ms 2532 KB Output is correct
21 Correct 68 ms 2576 KB Output is correct
22 Correct 92 ms 3040 KB Output is correct
23 Correct 91 ms 2720 KB Output is correct
24 Correct 94 ms 2804 KB Output is correct
25 Correct 95 ms 3048 KB Output is correct
26 Correct 92 ms 2752 KB Output is correct
27 Correct 96 ms 2732 KB Output is correct
28 Correct 86 ms 2688 KB Output is correct
29 Correct 126 ms 2784 KB Output is correct
30 Incorrect 25 ms 360 KB Incorrect
31 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1980 KB Output is correct
2 Correct 8 ms 2228 KB Output is correct
3 Correct 8 ms 2216 KB Output is correct
4 Correct 8 ms 2336 KB Output is correct
5 Correct 8 ms 2204 KB Output is correct
6 Correct 8 ms 2104 KB Output is correct
7 Correct 11 ms 2244 KB Output is correct
8 Correct 16 ms 2488 KB Output is correct
9 Correct 16 ms 2224 KB Output is correct
10 Correct 16 ms 2464 KB Output is correct
11 Correct 16 ms 2404 KB Output is correct
12 Correct 15 ms 2316 KB Output is correct
13 Correct 17 ms 2448 KB Output is correct
14 Correct 27 ms 2528 KB Output is correct
15 Correct 40 ms 2612 KB Output is correct
16 Correct 40 ms 2556 KB Output is correct
17 Correct 43 ms 2644 KB Output is correct
18 Correct 44 ms 2516 KB Output is correct
19 Correct 41 ms 2620 KB Output is correct
20 Correct 43 ms 2532 KB Output is correct
21 Correct 68 ms 2576 KB Output is correct
22 Correct 92 ms 3040 KB Output is correct
23 Correct 91 ms 2720 KB Output is correct
24 Correct 94 ms 2804 KB Output is correct
25 Correct 95 ms 3048 KB Output is correct
26 Correct 92 ms 2752 KB Output is correct
27 Correct 96 ms 2732 KB Output is correct
28 Correct 86 ms 2688 KB Output is correct
29 Correct 126 ms 2784 KB Output is correct
30 Incorrect 25 ms 360 KB Incorrect
31 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1980 KB Output is correct
2 Correct 8 ms 2228 KB Output is correct
3 Correct 8 ms 2216 KB Output is correct
4 Correct 8 ms 2336 KB Output is correct
5 Correct 8 ms 2204 KB Output is correct
6 Correct 8 ms 2104 KB Output is correct
7 Correct 11 ms 2244 KB Output is correct
8 Correct 16 ms 2488 KB Output is correct
9 Correct 16 ms 2224 KB Output is correct
10 Correct 16 ms 2464 KB Output is correct
11 Correct 16 ms 2404 KB Output is correct
12 Correct 15 ms 2316 KB Output is correct
13 Correct 17 ms 2448 KB Output is correct
14 Correct 27 ms 2528 KB Output is correct
15 Correct 40 ms 2612 KB Output is correct
16 Correct 40 ms 2556 KB Output is correct
17 Correct 43 ms 2644 KB Output is correct
18 Correct 44 ms 2516 KB Output is correct
19 Correct 41 ms 2620 KB Output is correct
20 Correct 43 ms 2532 KB Output is correct
21 Correct 68 ms 2576 KB Output is correct
22 Correct 92 ms 3040 KB Output is correct
23 Correct 91 ms 2720 KB Output is correct
24 Correct 94 ms 2804 KB Output is correct
25 Correct 95 ms 3048 KB Output is correct
26 Correct 92 ms 2752 KB Output is correct
27 Correct 96 ms 2732 KB Output is correct
28 Correct 86 ms 2688 KB Output is correct
29 Correct 126 ms 2784 KB Output is correct
30 Incorrect 25 ms 360 KB Incorrect
31 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1980 KB Output is correct
2 Correct 8 ms 2228 KB Output is correct
3 Correct 8 ms 2216 KB Output is correct
4 Correct 8 ms 2336 KB Output is correct
5 Correct 8 ms 2204 KB Output is correct
6 Correct 8 ms 2104 KB Output is correct
7 Correct 11 ms 2244 KB Output is correct
8 Correct 16 ms 2488 KB Output is correct
9 Correct 16 ms 2224 KB Output is correct
10 Correct 16 ms 2464 KB Output is correct
11 Correct 16 ms 2404 KB Output is correct
12 Correct 15 ms 2316 KB Output is correct
13 Correct 17 ms 2448 KB Output is correct
14 Correct 27 ms 2528 KB Output is correct
15 Correct 40 ms 2612 KB Output is correct
16 Correct 40 ms 2556 KB Output is correct
17 Correct 43 ms 2644 KB Output is correct
18 Correct 44 ms 2516 KB Output is correct
19 Correct 41 ms 2620 KB Output is correct
20 Correct 43 ms 2532 KB Output is correct
21 Correct 68 ms 2576 KB Output is correct
22 Correct 92 ms 3040 KB Output is correct
23 Correct 91 ms 2720 KB Output is correct
24 Correct 94 ms 2804 KB Output is correct
25 Correct 95 ms 3048 KB Output is correct
26 Correct 92 ms 2752 KB Output is correct
27 Correct 96 ms 2732 KB Output is correct
28 Correct 86 ms 2688 KB Output is correct
29 Correct 126 ms 2784 KB Output is correct
30 Incorrect 25 ms 360 KB Incorrect
31 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1980 KB Output is correct
2 Correct 8 ms 2228 KB Output is correct
3 Correct 8 ms 2216 KB Output is correct
4 Correct 8 ms 2336 KB Output is correct
5 Correct 8 ms 2204 KB Output is correct
6 Correct 8 ms 2104 KB Output is correct
7 Correct 11 ms 2244 KB Output is correct
8 Correct 16 ms 2488 KB Output is correct
9 Correct 16 ms 2224 KB Output is correct
10 Correct 16 ms 2464 KB Output is correct
11 Correct 16 ms 2404 KB Output is correct
12 Correct 15 ms 2316 KB Output is correct
13 Correct 17 ms 2448 KB Output is correct
14 Correct 27 ms 2528 KB Output is correct
15 Correct 40 ms 2612 KB Output is correct
16 Correct 40 ms 2556 KB Output is correct
17 Correct 43 ms 2644 KB Output is correct
18 Correct 44 ms 2516 KB Output is correct
19 Correct 41 ms 2620 KB Output is correct
20 Correct 43 ms 2532 KB Output is correct
21 Correct 68 ms 2576 KB Output is correct
22 Correct 92 ms 3040 KB Output is correct
23 Correct 91 ms 2720 KB Output is correct
24 Correct 94 ms 2804 KB Output is correct
25 Correct 95 ms 3048 KB Output is correct
26 Correct 92 ms 2752 KB Output is correct
27 Correct 96 ms 2732 KB Output is correct
28 Correct 86 ms 2688 KB Output is correct
29 Correct 126 ms 2784 KB Output is correct
30 Incorrect 25 ms 360 KB Incorrect
31 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1980 KB Output is correct
2 Correct 8 ms 2228 KB Output is correct
3 Correct 8 ms 2216 KB Output is correct
4 Correct 8 ms 2336 KB Output is correct
5 Correct 8 ms 2204 KB Output is correct
6 Correct 8 ms 2104 KB Output is correct
7 Correct 11 ms 2244 KB Output is correct
8 Correct 16 ms 2488 KB Output is correct
9 Correct 16 ms 2224 KB Output is correct
10 Correct 16 ms 2464 KB Output is correct
11 Correct 16 ms 2404 KB Output is correct
12 Correct 15 ms 2316 KB Output is correct
13 Correct 17 ms 2448 KB Output is correct
14 Correct 27 ms 2528 KB Output is correct
15 Correct 40 ms 2612 KB Output is correct
16 Correct 40 ms 2556 KB Output is correct
17 Correct 43 ms 2644 KB Output is correct
18 Correct 44 ms 2516 KB Output is correct
19 Correct 41 ms 2620 KB Output is correct
20 Correct 43 ms 2532 KB Output is correct
21 Correct 68 ms 2576 KB Output is correct
22 Correct 92 ms 3040 KB Output is correct
23 Correct 91 ms 2720 KB Output is correct
24 Correct 94 ms 2804 KB Output is correct
25 Correct 95 ms 3048 KB Output is correct
26 Correct 92 ms 2752 KB Output is correct
27 Correct 96 ms 2732 KB Output is correct
28 Correct 86 ms 2688 KB Output is correct
29 Correct 126 ms 2784 KB Output is correct
30 Incorrect 25 ms 360 KB Incorrect
31 Halted 0 ms 0 KB -