This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "mars.h"
#include <iostream>
#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]=='1') tl[map(ii, jj, (2*n)+1)] = '1';
}
}
return tl;
if (k == n - 1) {
n=2*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] and tl[i]=='1'){
++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] and tl[v]=='1')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;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |