Submission #1063949

#TimeUsernameProblemLanguageResultExecution timeMemory
1063949sleepntsheepMars (APIO22_mars)C++17
0 / 100
1 ms332 KiB
#include "mars.h" #include <queue> using namespace std; void sor(string &a, string &b) { for (int j = 1; j < 100; ++j) if (b[j] == '1') a[j] = '1'; } int map(int i, int j, int n) { return 1 + i * n + j; } string process(vector <vector<string>> a, int i, int j, int k, int n) { string tl = a[i][j]; for (int ii = i; ii < i + 3; ++ii) { for (int jj = j; jj < j + 3; ++jj) { sor(tl, a[ii][jj]); if (a[ii][jj][0]) tl[map(ii, jj, n)] = '1'; } } if (k == n - 1) { int vis[100] {},cmp{}; tl.erase(tl.begin()); queue<int> q; for (int i=0;i<n*n;++i){ if(not vis[i]){ ++cmp; q.push(i),vis[i]=1; while(q.size()){ int u=q.front();q.pop(); auto nq=[&](int v){if(v>=0 and v<n*n and not vis[v])vis[v]=1,q.push(v);}; if (u%n)nq(u-1); if ((u+1)%n)nq(u+1); nq(u-n),nq(u+n); } } } string out(100,'0'); for(int j=0;j<20;++j)if((cmp&(1<<j)))out[j]='1'; return out; } return tl; }
#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...