#include "mars.h"
#include<bits/stdc++.h>
using namespace std;
vector<vector<char>>now,vis;
void dfs(int i,int j,int n){
if(i<0||j<0||i>n*2+1||j>n*2+1||now[i][j]==0||vis[i][j]==1){
return ;
}
//cout<<i<<" "<<j<<"\n";
vis[i][j]=1;
dfs(i+1,j,n);
dfs(i,j+1,n);
dfs(i-1,j,n);
dfs(i,j-1,n);
}
string process(vector<vector<string>> a, int ii, int jj, int k, int n)
{
if(n>4){
return string(100 ,'0');
}
string ret(100,'0');
if(k==0){
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
if(a[i][j][0]=='1'){
ret[(ii+i)*(n*2+1)+jj+j]='1';
}
}
}
}
else{
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
for(int h=0;h<100;h++){
if(ret[h]=='0'){
if(a[i][j][h]=='1'){
ret[h]='1';
}
}
}
}
}
}
//cout<<k<<" "<<n<<endl;
if(k==n-1){
// for(int i=0;i<26;i++){
// cout<<ret[i]<<" ";
// }
// cout<<"\n";
now.resize(n*2+2,vector<char>(n*2+2));
vis.resize(n*2+2,vector<char>(2*n+2));
int cnt=0;
for(int i=0;i<100;i++){
if(ret[i]=='1'){
now[i/(n*2+1)][i%(n*2+1)]=1;
}
}
for(int i=0;i<n*2+1;i++){
for(int j=0;j<n*2+1;j++){
if(vis[i][j]==0&&now[i][j]==1){
cnt++;
dfs(i,j,n);
}
}
}
now.clear();
vis.clear();
ret.clear();
while(cnt>0){
if(cnt&1){
ret.push_back('1');
}
else{
ret.push_back('0');
}
cnt/=2;
}
while(ret.size()<100){
ret.push_back('0');
}
}
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1684 KB |
Output is correct |
2 |
Correct |
8 ms |
1788 KB |
Output is correct |
3 |
Correct |
8 ms |
2100 KB |
Output is correct |
4 |
Correct |
8 ms |
1992 KB |
Output is correct |
5 |
Correct |
8 ms |
1872 KB |
Output is correct |
6 |
Correct |
8 ms |
1776 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1684 KB |
Output is correct |
2 |
Correct |
8 ms |
1788 KB |
Output is correct |
3 |
Correct |
8 ms |
2100 KB |
Output is correct |
4 |
Correct |
8 ms |
1992 KB |
Output is correct |
5 |
Correct |
8 ms |
1872 KB |
Output is correct |
6 |
Correct |
8 ms |
1776 KB |
Output is correct |
7 |
Correct |
11 ms |
1908 KB |
Output is correct |
8 |
Correct |
17 ms |
1872 KB |
Output is correct |
9 |
Correct |
17 ms |
2192 KB |
Output is correct |
10 |
Correct |
17 ms |
2036 KB |
Output is correct |
11 |
Correct |
16 ms |
1868 KB |
Output is correct |
12 |
Correct |
20 ms |
1976 KB |
Output is correct |
13 |
Correct |
16 ms |
2036 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1684 KB |
Output is correct |
2 |
Correct |
8 ms |
1788 KB |
Output is correct |
3 |
Correct |
8 ms |
2100 KB |
Output is correct |
4 |
Correct |
8 ms |
1992 KB |
Output is correct |
5 |
Correct |
8 ms |
1872 KB |
Output is correct |
6 |
Correct |
8 ms |
1776 KB |
Output is correct |
7 |
Correct |
11 ms |
1908 KB |
Output is correct |
8 |
Correct |
17 ms |
1872 KB |
Output is correct |
9 |
Correct |
17 ms |
2192 KB |
Output is correct |
10 |
Correct |
17 ms |
2036 KB |
Output is correct |
11 |
Correct |
16 ms |
1868 KB |
Output is correct |
12 |
Correct |
20 ms |
1976 KB |
Output is correct |
13 |
Correct |
16 ms |
2036 KB |
Output is correct |
14 |
Incorrect |
3 ms |
200 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1684 KB |
Output is correct |
2 |
Correct |
8 ms |
1788 KB |
Output is correct |
3 |
Correct |
8 ms |
2100 KB |
Output is correct |
4 |
Correct |
8 ms |
1992 KB |
Output is correct |
5 |
Correct |
8 ms |
1872 KB |
Output is correct |
6 |
Correct |
8 ms |
1776 KB |
Output is correct |
7 |
Correct |
11 ms |
1908 KB |
Output is correct |
8 |
Correct |
17 ms |
1872 KB |
Output is correct |
9 |
Correct |
17 ms |
2192 KB |
Output is correct |
10 |
Correct |
17 ms |
2036 KB |
Output is correct |
11 |
Correct |
16 ms |
1868 KB |
Output is correct |
12 |
Correct |
20 ms |
1976 KB |
Output is correct |
13 |
Correct |
16 ms |
2036 KB |
Output is correct |
14 |
Incorrect |
3 ms |
200 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1684 KB |
Output is correct |
2 |
Correct |
8 ms |
1788 KB |
Output is correct |
3 |
Correct |
8 ms |
2100 KB |
Output is correct |
4 |
Correct |
8 ms |
1992 KB |
Output is correct |
5 |
Correct |
8 ms |
1872 KB |
Output is correct |
6 |
Correct |
8 ms |
1776 KB |
Output is correct |
7 |
Correct |
11 ms |
1908 KB |
Output is correct |
8 |
Correct |
17 ms |
1872 KB |
Output is correct |
9 |
Correct |
17 ms |
2192 KB |
Output is correct |
10 |
Correct |
17 ms |
2036 KB |
Output is correct |
11 |
Correct |
16 ms |
1868 KB |
Output is correct |
12 |
Correct |
20 ms |
1976 KB |
Output is correct |
13 |
Correct |
16 ms |
2036 KB |
Output is correct |
14 |
Incorrect |
3 ms |
200 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1684 KB |
Output is correct |
2 |
Correct |
8 ms |
1788 KB |
Output is correct |
3 |
Correct |
8 ms |
2100 KB |
Output is correct |
4 |
Correct |
8 ms |
1992 KB |
Output is correct |
5 |
Correct |
8 ms |
1872 KB |
Output is correct |
6 |
Correct |
8 ms |
1776 KB |
Output is correct |
7 |
Correct |
11 ms |
1908 KB |
Output is correct |
8 |
Correct |
17 ms |
1872 KB |
Output is correct |
9 |
Correct |
17 ms |
2192 KB |
Output is correct |
10 |
Correct |
17 ms |
2036 KB |
Output is correct |
11 |
Correct |
16 ms |
1868 KB |
Output is correct |
12 |
Correct |
20 ms |
1976 KB |
Output is correct |
13 |
Correct |
16 ms |
2036 KB |
Output is correct |
14 |
Incorrect |
3 ms |
200 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1684 KB |
Output is correct |
2 |
Correct |
8 ms |
1788 KB |
Output is correct |
3 |
Correct |
8 ms |
2100 KB |
Output is correct |
4 |
Correct |
8 ms |
1992 KB |
Output is correct |
5 |
Correct |
8 ms |
1872 KB |
Output is correct |
6 |
Correct |
8 ms |
1776 KB |
Output is correct |
7 |
Correct |
11 ms |
1908 KB |
Output is correct |
8 |
Correct |
17 ms |
1872 KB |
Output is correct |
9 |
Correct |
17 ms |
2192 KB |
Output is correct |
10 |
Correct |
17 ms |
2036 KB |
Output is correct |
11 |
Correct |
16 ms |
1868 KB |
Output is correct |
12 |
Correct |
20 ms |
1976 KB |
Output is correct |
13 |
Correct |
16 ms |
2036 KB |
Output is correct |
14 |
Incorrect |
3 ms |
200 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1684 KB |
Output is correct |
2 |
Correct |
8 ms |
1788 KB |
Output is correct |
3 |
Correct |
8 ms |
2100 KB |
Output is correct |
4 |
Correct |
8 ms |
1992 KB |
Output is correct |
5 |
Correct |
8 ms |
1872 KB |
Output is correct |
6 |
Correct |
8 ms |
1776 KB |
Output is correct |
7 |
Correct |
11 ms |
1908 KB |
Output is correct |
8 |
Correct |
17 ms |
1872 KB |
Output is correct |
9 |
Correct |
17 ms |
2192 KB |
Output is correct |
10 |
Correct |
17 ms |
2036 KB |
Output is correct |
11 |
Correct |
16 ms |
1868 KB |
Output is correct |
12 |
Correct |
20 ms |
1976 KB |
Output is correct |
13 |
Correct |
16 ms |
2036 KB |
Output is correct |
14 |
Incorrect |
3 ms |
200 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1684 KB |
Output is correct |
2 |
Correct |
8 ms |
1788 KB |
Output is correct |
3 |
Correct |
8 ms |
2100 KB |
Output is correct |
4 |
Correct |
8 ms |
1992 KB |
Output is correct |
5 |
Correct |
8 ms |
1872 KB |
Output is correct |
6 |
Correct |
8 ms |
1776 KB |
Output is correct |
7 |
Correct |
11 ms |
1908 KB |
Output is correct |
8 |
Correct |
17 ms |
1872 KB |
Output is correct |
9 |
Correct |
17 ms |
2192 KB |
Output is correct |
10 |
Correct |
17 ms |
2036 KB |
Output is correct |
11 |
Correct |
16 ms |
1868 KB |
Output is correct |
12 |
Correct |
20 ms |
1976 KB |
Output is correct |
13 |
Correct |
16 ms |
2036 KB |
Output is correct |
14 |
Incorrect |
3 ms |
200 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1684 KB |
Output is correct |
2 |
Correct |
8 ms |
1788 KB |
Output is correct |
3 |
Correct |
8 ms |
2100 KB |
Output is correct |
4 |
Correct |
8 ms |
1992 KB |
Output is correct |
5 |
Correct |
8 ms |
1872 KB |
Output is correct |
6 |
Correct |
8 ms |
1776 KB |
Output is correct |
7 |
Correct |
11 ms |
1908 KB |
Output is correct |
8 |
Correct |
17 ms |
1872 KB |
Output is correct |
9 |
Correct |
17 ms |
2192 KB |
Output is correct |
10 |
Correct |
17 ms |
2036 KB |
Output is correct |
11 |
Correct |
16 ms |
1868 KB |
Output is correct |
12 |
Correct |
20 ms |
1976 KB |
Output is correct |
13 |
Correct |
16 ms |
2036 KB |
Output is correct |
14 |
Incorrect |
3 ms |
200 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |