Submission #957629

#TimeUsernameProblemLanguageResultExecution timeMemory
957629vjudge1Mars (APIO22_mars)C++17
14 / 100
12 ms4168 KiB
#include <bits/stdc++.h> #define f first #define s second #define ent '\n' //#define int long long #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma GCC optimize("Ofast,unroll-loops,fast-math,O3") const int dx[]={-1, 1, 0, 0, 0}; const int dy[]={0, 0, 1, -1, 0}; typedef long long ll; using namespace std; const int mx=1e6+12; const int mod=998244353; const bool T=1; bool used[200][200]; int pos(int x,int y,int n){ return y*n+x; } void dfs(int x,int y,int n){ used[x][y]=1; for(int i=0;i<4;i++){ int x1=dx[i]+x, y1=dy[i]+y; if(min(x1, y1)>=0 && max(x1, y1)<n && !used[x1][y1]){ dfs(x1, y1, n); } } } std::string process(std::vector<std::vector<std::string> > a,int x,int y,int k,int n){ k++; string ans=""; while(ans.size()<100){ ans+='0'; } for(int i=x;i<x+2*k+1;i++){ for(int j=y;j<y+2*k+1;j++){ int lx=min(i, x+2), rx=min(j, y+2); ans[pos(i-x, j-y, 2*k+1)]=a[lx-x][rx-y][pos(i-lx, j-rx, 2*k-1)]; } } if(k==n){ for(int i=0;i<2*n+1;i++){ for(int j=0;j<2*n+1;j++){ used[i][j]=(ans[pos(i, j, 2*n+1)] == '0'); } } int cnt=0; for(int i=0;i<2*n+1;i++){ for(int j=0;j<2*n+1;j++){ if(!used[i][j]){ cnt++; dfs(i, j, 2*n+1); } } } for(int i=0;i<100;i++){ if(i>=20){ ans[i]='0'; } else{ if((cnt&(1<<i))){ ans[i]='1'; } else{ ans[i]='0'; } } } } return ans; }
#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...