답안 #724429

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
724429 2023-04-15T08:41:59 Z MohamedAliSaidane 화성 (APIO22_mars) C++17
14 / 100
17 ms 2112 KB
#include<bits/stdc++.h>
#include "mars.h"
#include<ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vpi;

#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(),(x).end()



string process(vector<vector<string>> a, int i, int j, int k, int n)
{
    int nx[4] = {1, -1, 0, 0};
    int ny[4] = {0, 0, 1, -1};
    int bs[100];
    memset(bs, 0, sizeof(bs));
    if(k == 0)
    {
        for(int l = i; l < i + 3; l++)
        {
            for(int p = j; p < j+3; p++)
            {
                int id = (2 * n + 1) * l + p;
                bs[id] = (int)(a[l - i][p - j][0] - '0');
            }
        }
    }
    else
    {
        for(int l = i; l < i + 3; l++)
        {
            for(int p = j; p < j+3; p++)
            {
                for(int h = 0; h < 100; h++)
                    bs[h] = (bs[h]) |  (int)(a[l-i][p-j][h] - '0');
            }
        }
    }
    string ans = "";
    if(k == n -1)
    {
        for(int h = 0; h < 100; h++)
            ans += '0';

        int mp[2 * n + 1][2 * n + 1];
        memset(mp, 0, sizeof(mp));
        for(int h = 0; h < (2 * n + 1) * (2 * n + 1); h++)
        {
            mp[h/(2 * n + 1)][h % (2 * n + 1)] = bs[h];
        }
        int vis[2 * n + 1][2 * n + 1];
        memset(vis, 0, sizeof(vis));
        int cnt = 0;
        for(int l =0; l < 2 * n + 1;l ++)
        {
            for(int p = 0; p < 2 * n + 1; p++)
            {
                if(mp[l][p] & (1 - vis[l][p]))
                {
                    cnt++;
                    queue<pii> q;
                    q.push({l, p});
                    vis[l][p] = 1;
                    while(!q.empty())
                    {
                        pii u = q.front();
                        q.pop();
                        for(int h = 0; h < 4; h++)
                        {
                            int x = nx[h] + u.ff;
                            int y = ny[h] + u.ss;
                            if((x >= 0) && (x < 2 * n + 1) && (y >= 0) && (y < 2 * n + 1) &&
                               mp[x][y] && (1 - vis[x][y]))
                            {
                                vis[x][y] = 1;
                                q.push({x, y});
                            }
                        }
                    }
                }
            }
        }
        for(int h =0; h < 10; h++)
        {
            if((1 << h) & cnt)
                ans[h] = '1';
        }
    }
    else
    {
        for(int h = 0; h < 100; h++)
            ans += (char)('0' + (int)(bs[h]));
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1808 KB Output is correct
2 Correct 8 ms 1940 KB Output is correct
3 Correct 8 ms 2044 KB Output is correct
4 Correct 7 ms 2072 KB Output is correct
5 Correct 8 ms 1948 KB Output is correct
6 Correct 8 ms 2028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1808 KB Output is correct
2 Correct 8 ms 1940 KB Output is correct
3 Correct 8 ms 2044 KB Output is correct
4 Correct 7 ms 2072 KB Output is correct
5 Correct 8 ms 1948 KB Output is correct
6 Correct 8 ms 2028 KB Output is correct
7 Correct 11 ms 1772 KB Output is correct
8 Correct 16 ms 2056 KB Output is correct
9 Correct 16 ms 2076 KB Output is correct
10 Correct 16 ms 1740 KB Output is correct
11 Correct 16 ms 2112 KB Output is correct
12 Correct 16 ms 1952 KB Output is correct
13 Correct 17 ms 1868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1808 KB Output is correct
2 Correct 8 ms 1940 KB Output is correct
3 Correct 8 ms 2044 KB Output is correct
4 Correct 7 ms 2072 KB Output is correct
5 Correct 8 ms 1948 KB Output is correct
6 Correct 8 ms 2028 KB Output is correct
7 Correct 11 ms 1772 KB Output is correct
8 Correct 16 ms 2056 KB Output is correct
9 Correct 16 ms 2076 KB Output is correct
10 Correct 16 ms 1740 KB Output is correct
11 Correct 16 ms 2112 KB Output is correct
12 Correct 16 ms 1952 KB Output is correct
13 Correct 17 ms 1868 KB Output is correct
14 Runtime error 1 ms 332 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1808 KB Output is correct
2 Correct 8 ms 1940 KB Output is correct
3 Correct 8 ms 2044 KB Output is correct
4 Correct 7 ms 2072 KB Output is correct
5 Correct 8 ms 1948 KB Output is correct
6 Correct 8 ms 2028 KB Output is correct
7 Correct 11 ms 1772 KB Output is correct
8 Correct 16 ms 2056 KB Output is correct
9 Correct 16 ms 2076 KB Output is correct
10 Correct 16 ms 1740 KB Output is correct
11 Correct 16 ms 2112 KB Output is correct
12 Correct 16 ms 1952 KB Output is correct
13 Correct 17 ms 1868 KB Output is correct
14 Runtime error 1 ms 332 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1808 KB Output is correct
2 Correct 8 ms 1940 KB Output is correct
3 Correct 8 ms 2044 KB Output is correct
4 Correct 7 ms 2072 KB Output is correct
5 Correct 8 ms 1948 KB Output is correct
6 Correct 8 ms 2028 KB Output is correct
7 Correct 11 ms 1772 KB Output is correct
8 Correct 16 ms 2056 KB Output is correct
9 Correct 16 ms 2076 KB Output is correct
10 Correct 16 ms 1740 KB Output is correct
11 Correct 16 ms 2112 KB Output is correct
12 Correct 16 ms 1952 KB Output is correct
13 Correct 17 ms 1868 KB Output is correct
14 Runtime error 1 ms 332 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1808 KB Output is correct
2 Correct 8 ms 1940 KB Output is correct
3 Correct 8 ms 2044 KB Output is correct
4 Correct 7 ms 2072 KB Output is correct
5 Correct 8 ms 1948 KB Output is correct
6 Correct 8 ms 2028 KB Output is correct
7 Correct 11 ms 1772 KB Output is correct
8 Correct 16 ms 2056 KB Output is correct
9 Correct 16 ms 2076 KB Output is correct
10 Correct 16 ms 1740 KB Output is correct
11 Correct 16 ms 2112 KB Output is correct
12 Correct 16 ms 1952 KB Output is correct
13 Correct 17 ms 1868 KB Output is correct
14 Runtime error 1 ms 332 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1808 KB Output is correct
2 Correct 8 ms 1940 KB Output is correct
3 Correct 8 ms 2044 KB Output is correct
4 Correct 7 ms 2072 KB Output is correct
5 Correct 8 ms 1948 KB Output is correct
6 Correct 8 ms 2028 KB Output is correct
7 Correct 11 ms 1772 KB Output is correct
8 Correct 16 ms 2056 KB Output is correct
9 Correct 16 ms 2076 KB Output is correct
10 Correct 16 ms 1740 KB Output is correct
11 Correct 16 ms 2112 KB Output is correct
12 Correct 16 ms 1952 KB Output is correct
13 Correct 17 ms 1868 KB Output is correct
14 Runtime error 1 ms 332 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1808 KB Output is correct
2 Correct 8 ms 1940 KB Output is correct
3 Correct 8 ms 2044 KB Output is correct
4 Correct 7 ms 2072 KB Output is correct
5 Correct 8 ms 1948 KB Output is correct
6 Correct 8 ms 2028 KB Output is correct
7 Correct 11 ms 1772 KB Output is correct
8 Correct 16 ms 2056 KB Output is correct
9 Correct 16 ms 2076 KB Output is correct
10 Correct 16 ms 1740 KB Output is correct
11 Correct 16 ms 2112 KB Output is correct
12 Correct 16 ms 1952 KB Output is correct
13 Correct 17 ms 1868 KB Output is correct
14 Runtime error 1 ms 332 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1808 KB Output is correct
2 Correct 8 ms 1940 KB Output is correct
3 Correct 8 ms 2044 KB Output is correct
4 Correct 7 ms 2072 KB Output is correct
5 Correct 8 ms 1948 KB Output is correct
6 Correct 8 ms 2028 KB Output is correct
7 Correct 11 ms 1772 KB Output is correct
8 Correct 16 ms 2056 KB Output is correct
9 Correct 16 ms 2076 KB Output is correct
10 Correct 16 ms 1740 KB Output is correct
11 Correct 16 ms 2112 KB Output is correct
12 Correct 16 ms 1952 KB Output is correct
13 Correct 17 ms 1868 KB Output is correct
14 Runtime error 1 ms 332 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1808 KB Output is correct
2 Correct 8 ms 1940 KB Output is correct
3 Correct 8 ms 2044 KB Output is correct
4 Correct 7 ms 2072 KB Output is correct
5 Correct 8 ms 1948 KB Output is correct
6 Correct 8 ms 2028 KB Output is correct
7 Correct 11 ms 1772 KB Output is correct
8 Correct 16 ms 2056 KB Output is correct
9 Correct 16 ms 2076 KB Output is correct
10 Correct 16 ms 1740 KB Output is correct
11 Correct 16 ms 2112 KB Output is correct
12 Correct 16 ms 1952 KB Output is correct
13 Correct 17 ms 1868 KB Output is correct
14 Runtime error 1 ms 332 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -