답안 #976467

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
976467 2024-05-06T15:09:30 Z Unforgettablepl 화성 (APIO22_mars) C++17
14 / 100
12 ms 4200 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

int get_idx(int i,int j,int n){
    return i*(2*n+1) + j;
}

bool grid[11][11];
bool visited[11][11];

void dfs(int i,int j){
    if(visited[i][j] or !grid[i][j])return;
    visited[i][j]=true;
    dfs(i-1,j);
    dfs(i,j-1);
    dfs(i+1,j);
    dfs(i,j+1);
}

string process(vector<vector<string>> a, int32_t i, int32_t j, int32_t k, int32_t n){
    string ans(100,'0');
    for(int offseti = 0;offseti<3;offseti++){
        for(int offsetj=0;offsetj<3;offsetj++){
            if(a[offseti][offsetj][0]=='1')ans[get_idx(i+offseti,j+offsetj,n)+1]='1';
            for(int x=1;x<=81;x++)if(a[offseti][offsetj][x]=='1')ans[x]='1';
        }
    }
    if(k==n-1){
        for(auto&x:visited)for(bool&y:x)y=false;
        for(auto&x:grid)for(bool&y:x)y=false;
        // TODO code the dfs
        for(int x=1;x<=81;x++){
            if(ans[x]!='1')continue;
            int newx = (x-1)/(2*n+1);
            int newy = (x-1)%(2*n+1);
            grid[newx+1][newy+1]=true;
        }
        int cans = 0;
        for(int x=1;x<=9;x++){
            for(int y=1;y<=9;y++){
                if(grid[x][y] and !visited[x][y]){dfs(x,y);cans++;}
            }
        }
        ans = string(100,'0');
        for(int bit=0;bit<=31;bit++){
            if(cans&(1ll<<bit))ans[bit]='1';
        }
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 4024 KB Output is correct
2 Correct 7 ms 3688 KB Output is correct
3 Correct 7 ms 3768 KB Output is correct
4 Correct 6 ms 3532 KB Output is correct
5 Correct 6 ms 3788 KB Output is correct
6 Correct 7 ms 3852 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 4024 KB Output is correct
2 Correct 7 ms 3688 KB Output is correct
3 Correct 7 ms 3768 KB Output is correct
4 Correct 6 ms 3532 KB Output is correct
5 Correct 6 ms 3788 KB Output is correct
6 Correct 7 ms 3852 KB Output is correct
7 Correct 8 ms 3520 KB Output is correct
8 Correct 10 ms 3952 KB Output is correct
9 Correct 10 ms 4116 KB Output is correct
10 Correct 10 ms 4108 KB Output is correct
11 Correct 8 ms 4112 KB Output is correct
12 Correct 11 ms 4200 KB Output is correct
13 Correct 12 ms 3944 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 4024 KB Output is correct
2 Correct 7 ms 3688 KB Output is correct
3 Correct 7 ms 3768 KB Output is correct
4 Correct 6 ms 3532 KB Output is correct
5 Correct 6 ms 3788 KB Output is correct
6 Correct 7 ms 3852 KB Output is correct
7 Correct 8 ms 3520 KB Output is correct
8 Correct 10 ms 3952 KB Output is correct
9 Correct 10 ms 4116 KB Output is correct
10 Correct 10 ms 4108 KB Output is correct
11 Correct 8 ms 4112 KB Output is correct
12 Correct 11 ms 4200 KB Output is correct
13 Correct 12 ms 3944 KB Output is correct
14 Runtime error 1 ms 844 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 4024 KB Output is correct
2 Correct 7 ms 3688 KB Output is correct
3 Correct 7 ms 3768 KB Output is correct
4 Correct 6 ms 3532 KB Output is correct
5 Correct 6 ms 3788 KB Output is correct
6 Correct 7 ms 3852 KB Output is correct
7 Correct 8 ms 3520 KB Output is correct
8 Correct 10 ms 3952 KB Output is correct
9 Correct 10 ms 4116 KB Output is correct
10 Correct 10 ms 4108 KB Output is correct
11 Correct 8 ms 4112 KB Output is correct
12 Correct 11 ms 4200 KB Output is correct
13 Correct 12 ms 3944 KB Output is correct
14 Runtime error 1 ms 844 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 4024 KB Output is correct
2 Correct 7 ms 3688 KB Output is correct
3 Correct 7 ms 3768 KB Output is correct
4 Correct 6 ms 3532 KB Output is correct
5 Correct 6 ms 3788 KB Output is correct
6 Correct 7 ms 3852 KB Output is correct
7 Correct 8 ms 3520 KB Output is correct
8 Correct 10 ms 3952 KB Output is correct
9 Correct 10 ms 4116 KB Output is correct
10 Correct 10 ms 4108 KB Output is correct
11 Correct 8 ms 4112 KB Output is correct
12 Correct 11 ms 4200 KB Output is correct
13 Correct 12 ms 3944 KB Output is correct
14 Runtime error 1 ms 844 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 4024 KB Output is correct
2 Correct 7 ms 3688 KB Output is correct
3 Correct 7 ms 3768 KB Output is correct
4 Correct 6 ms 3532 KB Output is correct
5 Correct 6 ms 3788 KB Output is correct
6 Correct 7 ms 3852 KB Output is correct
7 Correct 8 ms 3520 KB Output is correct
8 Correct 10 ms 3952 KB Output is correct
9 Correct 10 ms 4116 KB Output is correct
10 Correct 10 ms 4108 KB Output is correct
11 Correct 8 ms 4112 KB Output is correct
12 Correct 11 ms 4200 KB Output is correct
13 Correct 12 ms 3944 KB Output is correct
14 Runtime error 1 ms 844 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 4024 KB Output is correct
2 Correct 7 ms 3688 KB Output is correct
3 Correct 7 ms 3768 KB Output is correct
4 Correct 6 ms 3532 KB Output is correct
5 Correct 6 ms 3788 KB Output is correct
6 Correct 7 ms 3852 KB Output is correct
7 Correct 8 ms 3520 KB Output is correct
8 Correct 10 ms 3952 KB Output is correct
9 Correct 10 ms 4116 KB Output is correct
10 Correct 10 ms 4108 KB Output is correct
11 Correct 8 ms 4112 KB Output is correct
12 Correct 11 ms 4200 KB Output is correct
13 Correct 12 ms 3944 KB Output is correct
14 Runtime error 1 ms 844 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 4024 KB Output is correct
2 Correct 7 ms 3688 KB Output is correct
3 Correct 7 ms 3768 KB Output is correct
4 Correct 6 ms 3532 KB Output is correct
5 Correct 6 ms 3788 KB Output is correct
6 Correct 7 ms 3852 KB Output is correct
7 Correct 8 ms 3520 KB Output is correct
8 Correct 10 ms 3952 KB Output is correct
9 Correct 10 ms 4116 KB Output is correct
10 Correct 10 ms 4108 KB Output is correct
11 Correct 8 ms 4112 KB Output is correct
12 Correct 11 ms 4200 KB Output is correct
13 Correct 12 ms 3944 KB Output is correct
14 Runtime error 1 ms 844 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 4024 KB Output is correct
2 Correct 7 ms 3688 KB Output is correct
3 Correct 7 ms 3768 KB Output is correct
4 Correct 6 ms 3532 KB Output is correct
5 Correct 6 ms 3788 KB Output is correct
6 Correct 7 ms 3852 KB Output is correct
7 Correct 8 ms 3520 KB Output is correct
8 Correct 10 ms 3952 KB Output is correct
9 Correct 10 ms 4116 KB Output is correct
10 Correct 10 ms 4108 KB Output is correct
11 Correct 8 ms 4112 KB Output is correct
12 Correct 11 ms 4200 KB Output is correct
13 Correct 12 ms 3944 KB Output is correct
14 Runtime error 1 ms 844 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 4024 KB Output is correct
2 Correct 7 ms 3688 KB Output is correct
3 Correct 7 ms 3768 KB Output is correct
4 Correct 6 ms 3532 KB Output is correct
5 Correct 6 ms 3788 KB Output is correct
6 Correct 7 ms 3852 KB Output is correct
7 Correct 8 ms 3520 KB Output is correct
8 Correct 10 ms 3952 KB Output is correct
9 Correct 10 ms 4116 KB Output is correct
10 Correct 10 ms 4108 KB Output is correct
11 Correct 8 ms 4112 KB Output is correct
12 Correct 11 ms 4200 KB Output is correct
13 Correct 12 ms 3944 KB Output is correct
14 Runtime error 1 ms 844 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -