#include "mars.h"
#include <cassert>
#include <iostream>
#include <queue>
using namespace std;
int map(int i, int j, int n) {
assert(i<n and j<n);
return 1 + i * n + j;
}
string process(vector <vector<string>> a, int i, int j, int k, int n)
{
string tl = a[0][0];
for (int ii = i; ii < i + 3; ++ii) {
for (int jj = j; jj < j + 3; ++jj) {
for(int k=1;k<100;++k)if(a[ii-i][jj-j][k]=='1')tl[k]='1';
if (a[ii-i][jj-j][0]=='1') tl[map(ii,jj,2*n+1)] = '1';
}
}
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;
}
return tl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2836 KB |
Output is correct |
2 |
Correct |
8 ms |
3020 KB |
Output is correct |
3 |
Correct |
7 ms |
2828 KB |
Output is correct |
4 |
Correct |
7 ms |
3200 KB |
Output is correct |
5 |
Correct |
7 ms |
3192 KB |
Output is correct |
6 |
Correct |
8 ms |
2740 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2836 KB |
Output is correct |
2 |
Correct |
8 ms |
3020 KB |
Output is correct |
3 |
Correct |
7 ms |
2828 KB |
Output is correct |
4 |
Correct |
7 ms |
3200 KB |
Output is correct |
5 |
Correct |
7 ms |
3192 KB |
Output is correct |
6 |
Correct |
8 ms |
2740 KB |
Output is correct |
7 |
Correct |
8 ms |
3032 KB |
Output is correct |
8 |
Correct |
14 ms |
2932 KB |
Output is correct |
9 |
Correct |
13 ms |
2936 KB |
Output is correct |
10 |
Correct |
9 ms |
2856 KB |
Output is correct |
11 |
Correct |
10 ms |
3048 KB |
Output is correct |
12 |
Correct |
14 ms |
3104 KB |
Output is correct |
13 |
Correct |
12 ms |
3152 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2836 KB |
Output is correct |
2 |
Correct |
8 ms |
3020 KB |
Output is correct |
3 |
Correct |
7 ms |
2828 KB |
Output is correct |
4 |
Correct |
7 ms |
3200 KB |
Output is correct |
5 |
Correct |
7 ms |
3192 KB |
Output is correct |
6 |
Correct |
8 ms |
2740 KB |
Output is correct |
7 |
Correct |
8 ms |
3032 KB |
Output is correct |
8 |
Correct |
14 ms |
2932 KB |
Output is correct |
9 |
Correct |
13 ms |
2936 KB |
Output is correct |
10 |
Correct |
9 ms |
2856 KB |
Output is correct |
11 |
Correct |
10 ms |
3048 KB |
Output is correct |
12 |
Correct |
14 ms |
3104 KB |
Output is correct |
13 |
Correct |
12 ms |
3152 KB |
Output is correct |
14 |
Runtime error |
1 ms |
596 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2836 KB |
Output is correct |
2 |
Correct |
8 ms |
3020 KB |
Output is correct |
3 |
Correct |
7 ms |
2828 KB |
Output is correct |
4 |
Correct |
7 ms |
3200 KB |
Output is correct |
5 |
Correct |
7 ms |
3192 KB |
Output is correct |
6 |
Correct |
8 ms |
2740 KB |
Output is correct |
7 |
Correct |
8 ms |
3032 KB |
Output is correct |
8 |
Correct |
14 ms |
2932 KB |
Output is correct |
9 |
Correct |
13 ms |
2936 KB |
Output is correct |
10 |
Correct |
9 ms |
2856 KB |
Output is correct |
11 |
Correct |
10 ms |
3048 KB |
Output is correct |
12 |
Correct |
14 ms |
3104 KB |
Output is correct |
13 |
Correct |
12 ms |
3152 KB |
Output is correct |
14 |
Runtime error |
1 ms |
596 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2836 KB |
Output is correct |
2 |
Correct |
8 ms |
3020 KB |
Output is correct |
3 |
Correct |
7 ms |
2828 KB |
Output is correct |
4 |
Correct |
7 ms |
3200 KB |
Output is correct |
5 |
Correct |
7 ms |
3192 KB |
Output is correct |
6 |
Correct |
8 ms |
2740 KB |
Output is correct |
7 |
Correct |
8 ms |
3032 KB |
Output is correct |
8 |
Correct |
14 ms |
2932 KB |
Output is correct |
9 |
Correct |
13 ms |
2936 KB |
Output is correct |
10 |
Correct |
9 ms |
2856 KB |
Output is correct |
11 |
Correct |
10 ms |
3048 KB |
Output is correct |
12 |
Correct |
14 ms |
3104 KB |
Output is correct |
13 |
Correct |
12 ms |
3152 KB |
Output is correct |
14 |
Runtime error |
1 ms |
596 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2836 KB |
Output is correct |
2 |
Correct |
8 ms |
3020 KB |
Output is correct |
3 |
Correct |
7 ms |
2828 KB |
Output is correct |
4 |
Correct |
7 ms |
3200 KB |
Output is correct |
5 |
Correct |
7 ms |
3192 KB |
Output is correct |
6 |
Correct |
8 ms |
2740 KB |
Output is correct |
7 |
Correct |
8 ms |
3032 KB |
Output is correct |
8 |
Correct |
14 ms |
2932 KB |
Output is correct |
9 |
Correct |
13 ms |
2936 KB |
Output is correct |
10 |
Correct |
9 ms |
2856 KB |
Output is correct |
11 |
Correct |
10 ms |
3048 KB |
Output is correct |
12 |
Correct |
14 ms |
3104 KB |
Output is correct |
13 |
Correct |
12 ms |
3152 KB |
Output is correct |
14 |
Runtime error |
1 ms |
596 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2836 KB |
Output is correct |
2 |
Correct |
8 ms |
3020 KB |
Output is correct |
3 |
Correct |
7 ms |
2828 KB |
Output is correct |
4 |
Correct |
7 ms |
3200 KB |
Output is correct |
5 |
Correct |
7 ms |
3192 KB |
Output is correct |
6 |
Correct |
8 ms |
2740 KB |
Output is correct |
7 |
Correct |
8 ms |
3032 KB |
Output is correct |
8 |
Correct |
14 ms |
2932 KB |
Output is correct |
9 |
Correct |
13 ms |
2936 KB |
Output is correct |
10 |
Correct |
9 ms |
2856 KB |
Output is correct |
11 |
Correct |
10 ms |
3048 KB |
Output is correct |
12 |
Correct |
14 ms |
3104 KB |
Output is correct |
13 |
Correct |
12 ms |
3152 KB |
Output is correct |
14 |
Runtime error |
1 ms |
596 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2836 KB |
Output is correct |
2 |
Correct |
8 ms |
3020 KB |
Output is correct |
3 |
Correct |
7 ms |
2828 KB |
Output is correct |
4 |
Correct |
7 ms |
3200 KB |
Output is correct |
5 |
Correct |
7 ms |
3192 KB |
Output is correct |
6 |
Correct |
8 ms |
2740 KB |
Output is correct |
7 |
Correct |
8 ms |
3032 KB |
Output is correct |
8 |
Correct |
14 ms |
2932 KB |
Output is correct |
9 |
Correct |
13 ms |
2936 KB |
Output is correct |
10 |
Correct |
9 ms |
2856 KB |
Output is correct |
11 |
Correct |
10 ms |
3048 KB |
Output is correct |
12 |
Correct |
14 ms |
3104 KB |
Output is correct |
13 |
Correct |
12 ms |
3152 KB |
Output is correct |
14 |
Runtime error |
1 ms |
596 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2836 KB |
Output is correct |
2 |
Correct |
8 ms |
3020 KB |
Output is correct |
3 |
Correct |
7 ms |
2828 KB |
Output is correct |
4 |
Correct |
7 ms |
3200 KB |
Output is correct |
5 |
Correct |
7 ms |
3192 KB |
Output is correct |
6 |
Correct |
8 ms |
2740 KB |
Output is correct |
7 |
Correct |
8 ms |
3032 KB |
Output is correct |
8 |
Correct |
14 ms |
2932 KB |
Output is correct |
9 |
Correct |
13 ms |
2936 KB |
Output is correct |
10 |
Correct |
9 ms |
2856 KB |
Output is correct |
11 |
Correct |
10 ms |
3048 KB |
Output is correct |
12 |
Correct |
14 ms |
3104 KB |
Output is correct |
13 |
Correct |
12 ms |
3152 KB |
Output is correct |
14 |
Runtime error |
1 ms |
596 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2836 KB |
Output is correct |
2 |
Correct |
8 ms |
3020 KB |
Output is correct |
3 |
Correct |
7 ms |
2828 KB |
Output is correct |
4 |
Correct |
7 ms |
3200 KB |
Output is correct |
5 |
Correct |
7 ms |
3192 KB |
Output is correct |
6 |
Correct |
8 ms |
2740 KB |
Output is correct |
7 |
Correct |
8 ms |
3032 KB |
Output is correct |
8 |
Correct |
14 ms |
2932 KB |
Output is correct |
9 |
Correct |
13 ms |
2936 KB |
Output is correct |
10 |
Correct |
9 ms |
2856 KB |
Output is correct |
11 |
Correct |
10 ms |
3048 KB |
Output is correct |
12 |
Correct |
14 ms |
3104 KB |
Output is correct |
13 |
Correct |
12 ms |
3152 KB |
Output is correct |
14 |
Runtime error |
1 ms |
596 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |