답안 #821125

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
821125 2023-08-11T07:36:36 Z Hanksburger 화성 (APIO22_mars) C++17
14 / 100
10 ms 2228 KB
#include "mars.h"
#include <bits/stdc++.h>
using namespace std;
string process(vector<vector<string> > a, int i, int j, int k, int n)
{
    if (i<2*(n-k-1) && j==2*(n-k-1))
    {
        a[0][0][1]=a[0][1][0];
        for (int i=0; i<=2*k; i++)
            a[0][0][i+2]=a[0][2][i];
    }
    else if (i==2*(n-k-1) && j<2*(n-k-1))
    {
        a[0][0][1]=a[1][0][0];
        for (int i=0; i<=2*k; i++)
            a[0][0][i+2]=a[2][0][i];
    }
    else if (i==2*(n-k-1) && j==2*(n-k-1))
    {
        a[0][0][1]=a[0][1][0];
        for (int i=0; i<=2*k; i++)
            a[0][0][i+2]=a[0][2][i];
        
        a[0][0][2*k+3]=a[1][0][0];
        a[0][0][2*k+4]=a[1][1][0];
        for (int i=0; i<=2*k; i++)
            a[0][0][i+2*k+5]=a[1][2][i];
        
        int ind=4*k+6;
        for (int i=0; i<=2*k; i++)
        {
            a[0][0][ind]=a[2][0][i];
            a[0][0][ind+1]=a[2][1][i];
            for (int j=0; j<=2*k; j++)
                a[0][0][j+ind+2]=a[2][2][i*(2*k+1)+j];
            ind+=2*k+3;
        }
    }
    if (k==n-1)
    {
        int visited[45][45], ans=0;
        for (int i=0; i<=2*n; i++)
            for (int j=0; j<=2*n; j++)
                visited[i][j]=0;
        pair<int, int> adj[4]={{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
        queue<pair<int, int> > q;
        for (int i=0; i<=2*n; i++)
        {
            for (int j=0; j<=2*n; j++)
            {
                if (a[0][0][i*(2*n+1)+j]=='1' && !visited[i][j])
                {
                    ans++;
                    visited[i][j]=1;
                    q.push({i, j});
                    while (!q.empty())
                    {
                        int ui=q.front().first, uj=q.front().second;
                        q.pop();
                        for (int l=0; l<4; l++)
                        {
                            int vi=ui+adj[l].first, vj=uj+adj[l].second;
                            if (0<=vi && vi<=2*n && 0<=vj && vj<=2*n && a[0][0][vi*(2*n+1)+vj]=='1' && !visited[vi][vj])
                            {
                                visited[vi][vj]=1;
                                q.push({vi, vj});
                            }
                        }
                    }
                }
            }
        }
        for (int i=0; i<10; i++)
            a[0][0][i]='0'+(bool)(ans&(1<<i));
        for (int i=10; i<100; i++)
            a[0][0][i]='0';
    }
    return a[0][0];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2228 KB Output is correct
2 Correct 4 ms 1980 KB Output is correct
3 Correct 3 ms 1956 KB Output is correct
4 Correct 3 ms 2024 KB Output is correct
5 Correct 6 ms 2044 KB Output is correct
6 Correct 6 ms 1816 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2228 KB Output is correct
2 Correct 4 ms 1980 KB Output is correct
3 Correct 3 ms 1956 KB Output is correct
4 Correct 3 ms 2024 KB Output is correct
5 Correct 6 ms 2044 KB Output is correct
6 Correct 6 ms 1816 KB Output is correct
7 Correct 7 ms 2036 KB Output is correct
8 Correct 10 ms 2016 KB Output is correct
9 Correct 8 ms 2104 KB Output is correct
10 Correct 8 ms 1764 KB Output is correct
11 Correct 8 ms 2028 KB Output is correct
12 Correct 8 ms 1928 KB Output is correct
13 Correct 8 ms 1948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2228 KB Output is correct
2 Correct 4 ms 1980 KB Output is correct
3 Correct 3 ms 1956 KB Output is correct
4 Correct 3 ms 2024 KB Output is correct
5 Correct 6 ms 2044 KB Output is correct
6 Correct 6 ms 1816 KB Output is correct
7 Correct 7 ms 2036 KB Output is correct
8 Correct 10 ms 2016 KB Output is correct
9 Correct 8 ms 2104 KB Output is correct
10 Correct 8 ms 1764 KB Output is correct
11 Correct 8 ms 2028 KB Output is correct
12 Correct 8 ms 1928 KB Output is correct
13 Correct 8 ms 1948 KB Output is correct
14 Runtime error 3 ms 428 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2228 KB Output is correct
2 Correct 4 ms 1980 KB Output is correct
3 Correct 3 ms 1956 KB Output is correct
4 Correct 3 ms 2024 KB Output is correct
5 Correct 6 ms 2044 KB Output is correct
6 Correct 6 ms 1816 KB Output is correct
7 Correct 7 ms 2036 KB Output is correct
8 Correct 10 ms 2016 KB Output is correct
9 Correct 8 ms 2104 KB Output is correct
10 Correct 8 ms 1764 KB Output is correct
11 Correct 8 ms 2028 KB Output is correct
12 Correct 8 ms 1928 KB Output is correct
13 Correct 8 ms 1948 KB Output is correct
14 Runtime error 3 ms 428 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2228 KB Output is correct
2 Correct 4 ms 1980 KB Output is correct
3 Correct 3 ms 1956 KB Output is correct
4 Correct 3 ms 2024 KB Output is correct
5 Correct 6 ms 2044 KB Output is correct
6 Correct 6 ms 1816 KB Output is correct
7 Correct 7 ms 2036 KB Output is correct
8 Correct 10 ms 2016 KB Output is correct
9 Correct 8 ms 2104 KB Output is correct
10 Correct 8 ms 1764 KB Output is correct
11 Correct 8 ms 2028 KB Output is correct
12 Correct 8 ms 1928 KB Output is correct
13 Correct 8 ms 1948 KB Output is correct
14 Runtime error 3 ms 428 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2228 KB Output is correct
2 Correct 4 ms 1980 KB Output is correct
3 Correct 3 ms 1956 KB Output is correct
4 Correct 3 ms 2024 KB Output is correct
5 Correct 6 ms 2044 KB Output is correct
6 Correct 6 ms 1816 KB Output is correct
7 Correct 7 ms 2036 KB Output is correct
8 Correct 10 ms 2016 KB Output is correct
9 Correct 8 ms 2104 KB Output is correct
10 Correct 8 ms 1764 KB Output is correct
11 Correct 8 ms 2028 KB Output is correct
12 Correct 8 ms 1928 KB Output is correct
13 Correct 8 ms 1948 KB Output is correct
14 Runtime error 3 ms 428 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2228 KB Output is correct
2 Correct 4 ms 1980 KB Output is correct
3 Correct 3 ms 1956 KB Output is correct
4 Correct 3 ms 2024 KB Output is correct
5 Correct 6 ms 2044 KB Output is correct
6 Correct 6 ms 1816 KB Output is correct
7 Correct 7 ms 2036 KB Output is correct
8 Correct 10 ms 2016 KB Output is correct
9 Correct 8 ms 2104 KB Output is correct
10 Correct 8 ms 1764 KB Output is correct
11 Correct 8 ms 2028 KB Output is correct
12 Correct 8 ms 1928 KB Output is correct
13 Correct 8 ms 1948 KB Output is correct
14 Runtime error 3 ms 428 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2228 KB Output is correct
2 Correct 4 ms 1980 KB Output is correct
3 Correct 3 ms 1956 KB Output is correct
4 Correct 3 ms 2024 KB Output is correct
5 Correct 6 ms 2044 KB Output is correct
6 Correct 6 ms 1816 KB Output is correct
7 Correct 7 ms 2036 KB Output is correct
8 Correct 10 ms 2016 KB Output is correct
9 Correct 8 ms 2104 KB Output is correct
10 Correct 8 ms 1764 KB Output is correct
11 Correct 8 ms 2028 KB Output is correct
12 Correct 8 ms 1928 KB Output is correct
13 Correct 8 ms 1948 KB Output is correct
14 Runtime error 3 ms 428 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2228 KB Output is correct
2 Correct 4 ms 1980 KB Output is correct
3 Correct 3 ms 1956 KB Output is correct
4 Correct 3 ms 2024 KB Output is correct
5 Correct 6 ms 2044 KB Output is correct
6 Correct 6 ms 1816 KB Output is correct
7 Correct 7 ms 2036 KB Output is correct
8 Correct 10 ms 2016 KB Output is correct
9 Correct 8 ms 2104 KB Output is correct
10 Correct 8 ms 1764 KB Output is correct
11 Correct 8 ms 2028 KB Output is correct
12 Correct 8 ms 1928 KB Output is correct
13 Correct 8 ms 1948 KB Output is correct
14 Runtime error 3 ms 428 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2228 KB Output is correct
2 Correct 4 ms 1980 KB Output is correct
3 Correct 3 ms 1956 KB Output is correct
4 Correct 3 ms 2024 KB Output is correct
5 Correct 6 ms 2044 KB Output is correct
6 Correct 6 ms 1816 KB Output is correct
7 Correct 7 ms 2036 KB Output is correct
8 Correct 10 ms 2016 KB Output is correct
9 Correct 8 ms 2104 KB Output is correct
10 Correct 8 ms 1764 KB Output is correct
11 Correct 8 ms 2028 KB Output is correct
12 Correct 8 ms 1928 KB Output is correct
13 Correct 8 ms 1948 KB Output is correct
14 Runtime error 3 ms 428 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -