| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1367721 | thesentro | Mars (APIO22_mars) | C++20 | 0 ms | 3152 KiB |
#include "mars.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
string st;
vector<ll>vis;
void dfs(ll x, ll y, ll val)
{
vis[x*val+y] = 1;
if (x+1<val)
{
if (vis[(x+1)*val+y]==0 and st[(x+1)*val+y]=='1')
dfs(x+1, y, val);
}
if (y+1<val)
{
if (vis[x*val+y+1]==0 and st[x*val+y+1]=='1')
dfs(x, y+1, val);
}
}
std::string process(std::vector <std::vector<std::string>> a, int i, int j, int k, int n)
{
string s(100, '0');
if (k==0)
{
for (int i1=0 ; i1<3 ; i1++)
{
for (int j1=0 ; j1<3 ; j1++)
{
if (a[i1][j1][0]=='1')
s[(i+i1)*(2*n+1)+(j+j1)] = '1';
}
}
// cout<<s<<endl;
}
else
{
for (int i1=0 ; i1<3 ; i1++)
{
for (int j1=0 ; j1<3 ; j1++)
{
for (int k1=0 ; k1<100 ; k1++)
{
if (a[i1+i][j1+j][k1]=='1')
s[k1] = a[i1+i][j1+j][k1];
}
}
}
}
if (k==n-1)
{
// cout<<s<<endl;
st = s;
vis.assign((2*n+1)*(2*n+1), 0);
ll cnt = 0;
for (int i=0 ; i<2*n+1 ; i++)
{
for (int j=0 ; j<2*n+1 ; j++)
{
if (vis[i*(2*n+1)+j]==0 and st[i*(2*n+1)+j]=='1')
{
cnt++;
dfs(i, j, 2*n+1);
// cout<<"_-"<<endl;
}
}
}
string ret(100, '0');
for (int i=0 ; i<30 ; i++)
{
if ((1<<i)&cnt)
ret[i] = '1';
}
return ret;
}
return s;
}
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
