제출 #1367757

#제출 시각아이디문제언어결과실행 시간메모리
1367757thesentro화성 (APIO22_mars)C++20
14 / 100
8 ms3308 KiB
#include "mars.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
string st;
vector<ll>vis;
void dfs(ll x, ll y, ll val)
{
    // cout<<x<<" "<<y<<endl;
    vis[x*val+y] = 1;
    if (x+1<val)
    {
        if (vis[(x+1)*val+y]==0 and st[(x+1)*val+y]=='1')
            dfs(x+1, y, val);
    }
    if (y+1<val)
    {
        if (vis[x*val+y+1]==0 and st[x*val+y+1]=='1')
            dfs(x, y+1, val);
    }
    if (x>0)
    {
        if (vis[(x-1)*val+y]==0 and st[(x-1)*val+y]=='1')
            dfs(x-1, y, val);
    }
    if (y>0)
    {
        if (vis[x*val+y-1]==0 and st[x*val+y-1]=='1')
            dfs(x, y-1, val);
    }
}
std::string process(std::vector <std::vector<std::string>> a, int i, int j, int k, int n)
{
    // cout<<k<<endl;
	string s(100, '0');
	if (k==0)
    {
        for (int i1=0 ; i1<3 ; i1++)
        {
            for (int j1=0 ; j1<3 ; j1++)
            {
                if (a[i1][j1][0]=='1')
                    s[(i+i1)*(2*n+1)+(j+j1)] = '1';
            }
        }
        // cout<<s<<endl;
    }
    else
    {
        for (int i1=0 ; i1<3 ; i1++)
        {
            for (int j1=0 ; j1<3 ; j1++)
            {
                for (int k1=0 ; k1<100 ; k1++)
                {
                    // cout<<k1<<endl;
                    if (a[i1][j1][k1]=='1')
                        s[k1] = a[i1][j1][k1];
                }
            }
        }
        // cout<<s<<endl;
    }
    if (k==n-1)
    {
        // cout<<s<<endl;
        st = s;
        vis.assign(101, 0);
        ll cnt = 0;
        for (int i=0 ; i<2*n+1 ; i++)
        {
            for (int j=0 ; j<2*n+1 ; j++)
            {
                if (vis[i*(2*n+1)+j]==0 and st[i*(2*n+1)+j]=='1')
                {
                    cnt++;
                    dfs(i, j, 2*n+1);
                    // cout<<"_-"<<endl;
                }
            }
        }
        // cout<<st<<endl;
        string ret(100, '0');
        for (int i=0 ; i<30 ; i++)
        {
            if ((1<<i)&cnt)
                ret[i] = '1';
        }
        return ret;
    }
    return s;
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…