Submission #1032943

#TimeUsernameProblemLanguageResultExecution timeMemory
1032943irmuunMars (APIO22_mars)C++17
0 / 100
1 ms588 KiB
#include<bits/stdc++.h> #include "mars.h" using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() const int N=50; char g[N][N]; bool used[N][N]; int ans=0,sz; vector<int>dx={-1,1,0,0}; vector<int>dy={0,0,-1,1}; void dfs(int i,int j){ used[i][j]=true; for(int k=0;k<4;k++){ int ni=i+dx[k],nj=j+dy[k]; if(ni<0||nj<0||ni>=sz||nj>=sz||g[ni][nj]=='0'||used[ni][nj]) continue; dfs(ni,nj); } } string process(vector<vector<string>>a,int i,int j,int k,int n){ if(n==2) assert(0==1); sz=n*2+1; if(n==1){ for(int x=0;x<=2;x++){ for(int y=0;y<=2;y++){ g[x][y]=a[x][y][0]; } } for(int x=0;x<=2;x++){ for(int y=0;y<=2;y++){ if(!used[x][y]&&g[x][y]=='1'){ ans++; dfs(x,y); } } } string s(100,'0'); int cur=0; while(ans){ if(ans&1){ s[cur]='1'; } cur++; ans>>=1; } return s; } else{ if(k==0){ string s(100,'0'); int cur=0; for(int x=0;x<=2;x++){ for(int y=0;y<=2;y++){ s[cur++]=a[x][y][0]; } } return s; } else{ for(int x=0;x<=2;x++){ for(int y=0;y<=2;y++){ int cur=0; for(int l=x;l<=x+2;l++){ for(int r=y;r<=y+2;r++){ g[l][r]=a[x][y][cur++]; } } } } ans=0; for(int x=0;x<=4;x++){ for(int y=0;y<=4;y++){ if(!used[x][y]&&g[x][y]=='1'){ ans++; dfs(x,y); } } } string s(100,'0'); int cur=0; while(ans){ if(ans&1){ s[cur]='1'; } cur++; ans>>=1; } return s; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...