Submission #976453

# Submission time Handle Problem Language Result Execution time Memory
976453 2024-05-06T15:01:04 Z Unforgettablepl Mars (APIO22_mars) C++17
0 / 100
1 ms 332 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){
    if(n==1)exit(1);
    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){
        // 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;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Incorrect
2 Halted 0 ms 0 KB -