답안 #1063935

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1063935 2024-08-18T06:18:58 Z 12345678 화성 (APIO22_mars) C++17
14 / 100
19 ms 3880 KB
#include "mars.h"
#include <bits/stdc++.h>

using namespace std;

int dx[]={1, 0, 0, -1}, dy[]={0, 1, -1, 0};

std::string process(std::vector <std::vector<std::string>> a, int _i, int _j, int _k, int n)
{
    vector<vector<int>> vs(3*n+10, vector<int> (3*n+10, 0)), mp(3*n+10, vector<int> (3*n+10, 0));
    for (int i=0; i<3; i++) 
    {
        for (int j=0; j<3; j++) 
        {
            for (int k=0; k<(2*n+1)*(2*n+1); k++) 
            {
                    mp[i+(k/(2*n+1))][j+(k%(2*n+1))]=a[i][j][k];
            }
        }
    }
    if (_k!=n-1)
    {
        string res(100, '0'); 
        for (int i=0; i<2*n+1; i++) for (int j=0; j<2*n+1; j++) res[(2*n+1)*i+j]=mp[i][j];
        //cout<<res<<'\n';
        return res;
    }
    /*
    for (int i=0; i<5; i++) 
    {
        for (int j=0; j<5;j ++) cout<<mp[i][j]-'0'<<' ';
        cout<<'\n';
    }*/
    int cnt=0;
    for (int i=0; i<2*n+1; i++)
    {
        for (int j=0; j<2*n+1; j++)
        {
            if (!vs[i][j]&&mp[i][j]=='1')
            {
                queue<pair<int, int>> q;
                vs[i][j]=1;
                q.push({i, j});
                cnt++;
                while (!q.empty())
                {
                    auto [x, y]=q.front();
                    q.pop();
                    for (int dr=0; dr<4; dr++)
                    {
                        int cx=x+dx[dr], cy=y+dy[dr];
                        if (cx<0||cx>2*n||cy<0||cy>2*n||vs[cx][cy]||mp[cx][cy]=='0') continue;
                        vs[cx][cy]=1;
                        q.push({cx, cy});
                    }
                }
            }
        }
    }
    string res(100, '0');
    for (int i=0; i<10; i++) if (cnt&(1<<i)) res[i]='1';
    return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 3524 KB Output is correct
2 Correct 4 ms 3492 KB Output is correct
3 Correct 9 ms 3880 KB Output is correct
4 Correct 10 ms 3708 KB Output is correct
5 Correct 9 ms 3468 KB Output is correct
6 Correct 8 ms 3468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 3524 KB Output is correct
2 Correct 4 ms 3492 KB Output is correct
3 Correct 9 ms 3880 KB Output is correct
4 Correct 10 ms 3708 KB Output is correct
5 Correct 9 ms 3468 KB Output is correct
6 Correct 8 ms 3468 KB Output is correct
7 Correct 12 ms 3524 KB Output is correct
8 Correct 16 ms 3520 KB Output is correct
9 Correct 16 ms 3548 KB Output is correct
10 Correct 12 ms 3064 KB Output is correct
11 Correct 17 ms 3412 KB Output is correct
12 Correct 14 ms 3576 KB Output is correct
13 Correct 19 ms 3392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 3524 KB Output is correct
2 Correct 4 ms 3492 KB Output is correct
3 Correct 9 ms 3880 KB Output is correct
4 Correct 10 ms 3708 KB Output is correct
5 Correct 9 ms 3468 KB Output is correct
6 Correct 8 ms 3468 KB Output is correct
7 Correct 12 ms 3524 KB Output is correct
8 Correct 16 ms 3520 KB Output is correct
9 Correct 16 ms 3548 KB Output is correct
10 Correct 12 ms 3064 KB Output is correct
11 Correct 17 ms 3412 KB Output is correct
12 Correct 14 ms 3576 KB Output is correct
13 Correct 19 ms 3392 KB Output is correct
14 Runtime error 1 ms 512 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 3524 KB Output is correct
2 Correct 4 ms 3492 KB Output is correct
3 Correct 9 ms 3880 KB Output is correct
4 Correct 10 ms 3708 KB Output is correct
5 Correct 9 ms 3468 KB Output is correct
6 Correct 8 ms 3468 KB Output is correct
7 Correct 12 ms 3524 KB Output is correct
8 Correct 16 ms 3520 KB Output is correct
9 Correct 16 ms 3548 KB Output is correct
10 Correct 12 ms 3064 KB Output is correct
11 Correct 17 ms 3412 KB Output is correct
12 Correct 14 ms 3576 KB Output is correct
13 Correct 19 ms 3392 KB Output is correct
14 Runtime error 1 ms 512 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 3524 KB Output is correct
2 Correct 4 ms 3492 KB Output is correct
3 Correct 9 ms 3880 KB Output is correct
4 Correct 10 ms 3708 KB Output is correct
5 Correct 9 ms 3468 KB Output is correct
6 Correct 8 ms 3468 KB Output is correct
7 Correct 12 ms 3524 KB Output is correct
8 Correct 16 ms 3520 KB Output is correct
9 Correct 16 ms 3548 KB Output is correct
10 Correct 12 ms 3064 KB Output is correct
11 Correct 17 ms 3412 KB Output is correct
12 Correct 14 ms 3576 KB Output is correct
13 Correct 19 ms 3392 KB Output is correct
14 Runtime error 1 ms 512 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 3524 KB Output is correct
2 Correct 4 ms 3492 KB Output is correct
3 Correct 9 ms 3880 KB Output is correct
4 Correct 10 ms 3708 KB Output is correct
5 Correct 9 ms 3468 KB Output is correct
6 Correct 8 ms 3468 KB Output is correct
7 Correct 12 ms 3524 KB Output is correct
8 Correct 16 ms 3520 KB Output is correct
9 Correct 16 ms 3548 KB Output is correct
10 Correct 12 ms 3064 KB Output is correct
11 Correct 17 ms 3412 KB Output is correct
12 Correct 14 ms 3576 KB Output is correct
13 Correct 19 ms 3392 KB Output is correct
14 Runtime error 1 ms 512 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 3524 KB Output is correct
2 Correct 4 ms 3492 KB Output is correct
3 Correct 9 ms 3880 KB Output is correct
4 Correct 10 ms 3708 KB Output is correct
5 Correct 9 ms 3468 KB Output is correct
6 Correct 8 ms 3468 KB Output is correct
7 Correct 12 ms 3524 KB Output is correct
8 Correct 16 ms 3520 KB Output is correct
9 Correct 16 ms 3548 KB Output is correct
10 Correct 12 ms 3064 KB Output is correct
11 Correct 17 ms 3412 KB Output is correct
12 Correct 14 ms 3576 KB Output is correct
13 Correct 19 ms 3392 KB Output is correct
14 Runtime error 1 ms 512 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 3524 KB Output is correct
2 Correct 4 ms 3492 KB Output is correct
3 Correct 9 ms 3880 KB Output is correct
4 Correct 10 ms 3708 KB Output is correct
5 Correct 9 ms 3468 KB Output is correct
6 Correct 8 ms 3468 KB Output is correct
7 Correct 12 ms 3524 KB Output is correct
8 Correct 16 ms 3520 KB Output is correct
9 Correct 16 ms 3548 KB Output is correct
10 Correct 12 ms 3064 KB Output is correct
11 Correct 17 ms 3412 KB Output is correct
12 Correct 14 ms 3576 KB Output is correct
13 Correct 19 ms 3392 KB Output is correct
14 Runtime error 1 ms 512 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 3524 KB Output is correct
2 Correct 4 ms 3492 KB Output is correct
3 Correct 9 ms 3880 KB Output is correct
4 Correct 10 ms 3708 KB Output is correct
5 Correct 9 ms 3468 KB Output is correct
6 Correct 8 ms 3468 KB Output is correct
7 Correct 12 ms 3524 KB Output is correct
8 Correct 16 ms 3520 KB Output is correct
9 Correct 16 ms 3548 KB Output is correct
10 Correct 12 ms 3064 KB Output is correct
11 Correct 17 ms 3412 KB Output is correct
12 Correct 14 ms 3576 KB Output is correct
13 Correct 19 ms 3392 KB Output is correct
14 Runtime error 1 ms 512 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 3524 KB Output is correct
2 Correct 4 ms 3492 KB Output is correct
3 Correct 9 ms 3880 KB Output is correct
4 Correct 10 ms 3708 KB Output is correct
5 Correct 9 ms 3468 KB Output is correct
6 Correct 8 ms 3468 KB Output is correct
7 Correct 12 ms 3524 KB Output is correct
8 Correct 16 ms 3520 KB Output is correct
9 Correct 16 ms 3548 KB Output is correct
10 Correct 12 ms 3064 KB Output is correct
11 Correct 17 ms 3412 KB Output is correct
12 Correct 14 ms 3576 KB Output is correct
13 Correct 19 ms 3392 KB Output is correct
14 Runtime error 1 ms 512 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -