# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
718410 |
2023-04-04T02:34:15 Z |
lam |
Mars (APIO22_mars) |
C++17 |
|
216 ms |
3144 KB |
#include "mars.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
#define ff first
#define ss second
const int maxn = 110;
int n,m;
bool A[maxn][maxn];
bool dau[maxn][maxn];
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
bool in(int x, int y)
{
if (x<0||x>=m||y<0||y>=m) return 0;
return A[x][y];
}
void dfs(int x, int y)
{
dau[x][y]=1;
// cerr<<"vis "<<x<<' '<<y<<endl;
for (int c=0; c<4; c++)
{
int xx=x+dx[c];
int yy=y+dy[c];
if (in(xx,yy)&&!dau[xx][yy]) dfs(xx,yy);
}
}
std::string process(std::vector <std::vector<std::string>> a, int i, int j, int k, int N)
{
n=N; m=2*n+1;
map<ii,bool> mp;
if (k!=n-1)
{
for (int i=0; i<3; i+=2)
for (int j=0; j<3; j+=2)
{
int cnt=0;
for (int i2=0; i2<=k; i2++)
for (int j2=0; j2<=k; j2++)
mp[{i+i2*2,j+j2*2}] = (a[i][j][cnt++]=='1');
}
string S="";
for (int i=0; i<=k+1; i++)
for (int j=0; j<=k+1; j++)
if (mp[{2*i,2*j}]==1) S+='1';
else S+='0';
while (S.length()<100) S+='0';
return S;
}
for (int i=0; i<3; i++)
for (int j=0; j<3; j++)
{
int cnt=0;
for (int i2=0; i2<=k; i2++)
for (int j2=0; j2<=k; j2++)
mp[{i+i2*2,j+j2*2}] = (a[i][j][cnt++]=='1');
}
for (int i=0; i<m; i++)
for (int j=0; j<m; j++)
A[i][j] = mp[{i,j}];
// for (int i=0; i<m; i++)
// {
// for (int j=0; j<m; j++)cerr<<A[i][j]<<' ';
// cerr<<endl;
// }
int ans = 0;
for (int i=0; i<m; i++)
for (int j=0; j<m; j++) dau[i][j]=0;
for (int i=0; i<m; i++)
for (int j=0; j<m; j++)
if (!dau[i][j]&&A[i][j]==1) dfs(i,j), ans++;
string S="";
while (ans>0)
{
if (ans&1) S+='1';
else S+='0';
ans/=2;
}
while (S.length()<100) S+='0';
return S;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2280 KB |
Output is correct |
2 |
Correct |
8 ms |
2100 KB |
Output is correct |
3 |
Correct |
8 ms |
2412 KB |
Output is correct |
4 |
Correct |
8 ms |
2016 KB |
Output is correct |
5 |
Correct |
8 ms |
2324 KB |
Output is correct |
6 |
Correct |
8 ms |
2144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2280 KB |
Output is correct |
2 |
Correct |
8 ms |
2100 KB |
Output is correct |
3 |
Correct |
8 ms |
2412 KB |
Output is correct |
4 |
Correct |
8 ms |
2016 KB |
Output is correct |
5 |
Correct |
8 ms |
2324 KB |
Output is correct |
6 |
Correct |
8 ms |
2144 KB |
Output is correct |
7 |
Correct |
10 ms |
2116 KB |
Output is correct |
8 |
Correct |
15 ms |
2132 KB |
Output is correct |
9 |
Correct |
17 ms |
2180 KB |
Output is correct |
10 |
Correct |
17 ms |
1880 KB |
Output is correct |
11 |
Correct |
16 ms |
2304 KB |
Output is correct |
12 |
Correct |
16 ms |
2380 KB |
Output is correct |
13 |
Correct |
16 ms |
2240 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2280 KB |
Output is correct |
2 |
Correct |
8 ms |
2100 KB |
Output is correct |
3 |
Correct |
8 ms |
2412 KB |
Output is correct |
4 |
Correct |
8 ms |
2016 KB |
Output is correct |
5 |
Correct |
8 ms |
2324 KB |
Output is correct |
6 |
Correct |
8 ms |
2144 KB |
Output is correct |
7 |
Correct |
10 ms |
2116 KB |
Output is correct |
8 |
Correct |
15 ms |
2132 KB |
Output is correct |
9 |
Correct |
17 ms |
2180 KB |
Output is correct |
10 |
Correct |
17 ms |
1880 KB |
Output is correct |
11 |
Correct |
16 ms |
2304 KB |
Output is correct |
12 |
Correct |
16 ms |
2380 KB |
Output is correct |
13 |
Correct |
16 ms |
2240 KB |
Output is correct |
14 |
Correct |
28 ms |
2496 KB |
Output is correct |
15 |
Correct |
49 ms |
2672 KB |
Output is correct |
16 |
Correct |
43 ms |
2568 KB |
Output is correct |
17 |
Correct |
43 ms |
2572 KB |
Output is correct |
18 |
Correct |
45 ms |
2528 KB |
Output is correct |
19 |
Correct |
44 ms |
2540 KB |
Output is correct |
20 |
Correct |
46 ms |
2564 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2280 KB |
Output is correct |
2 |
Correct |
8 ms |
2100 KB |
Output is correct |
3 |
Correct |
8 ms |
2412 KB |
Output is correct |
4 |
Correct |
8 ms |
2016 KB |
Output is correct |
5 |
Correct |
8 ms |
2324 KB |
Output is correct |
6 |
Correct |
8 ms |
2144 KB |
Output is correct |
7 |
Correct |
10 ms |
2116 KB |
Output is correct |
8 |
Correct |
15 ms |
2132 KB |
Output is correct |
9 |
Correct |
17 ms |
2180 KB |
Output is correct |
10 |
Correct |
17 ms |
1880 KB |
Output is correct |
11 |
Correct |
16 ms |
2304 KB |
Output is correct |
12 |
Correct |
16 ms |
2380 KB |
Output is correct |
13 |
Correct |
16 ms |
2240 KB |
Output is correct |
14 |
Correct |
28 ms |
2496 KB |
Output is correct |
15 |
Correct |
49 ms |
2672 KB |
Output is correct |
16 |
Correct |
43 ms |
2568 KB |
Output is correct |
17 |
Correct |
43 ms |
2572 KB |
Output is correct |
18 |
Correct |
45 ms |
2528 KB |
Output is correct |
19 |
Correct |
44 ms |
2540 KB |
Output is correct |
20 |
Correct |
46 ms |
2564 KB |
Output is correct |
21 |
Correct |
71 ms |
2748 KB |
Output is correct |
22 |
Correct |
102 ms |
2748 KB |
Output is correct |
23 |
Correct |
107 ms |
2868 KB |
Output is correct |
24 |
Correct |
100 ms |
2868 KB |
Output is correct |
25 |
Correct |
105 ms |
2816 KB |
Output is correct |
26 |
Correct |
97 ms |
2748 KB |
Output is correct |
27 |
Correct |
104 ms |
2824 KB |
Output is correct |
28 |
Correct |
93 ms |
2768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2280 KB |
Output is correct |
2 |
Correct |
8 ms |
2100 KB |
Output is correct |
3 |
Correct |
8 ms |
2412 KB |
Output is correct |
4 |
Correct |
8 ms |
2016 KB |
Output is correct |
5 |
Correct |
8 ms |
2324 KB |
Output is correct |
6 |
Correct |
8 ms |
2144 KB |
Output is correct |
7 |
Correct |
10 ms |
2116 KB |
Output is correct |
8 |
Correct |
15 ms |
2132 KB |
Output is correct |
9 |
Correct |
17 ms |
2180 KB |
Output is correct |
10 |
Correct |
17 ms |
1880 KB |
Output is correct |
11 |
Correct |
16 ms |
2304 KB |
Output is correct |
12 |
Correct |
16 ms |
2380 KB |
Output is correct |
13 |
Correct |
16 ms |
2240 KB |
Output is correct |
14 |
Correct |
28 ms |
2496 KB |
Output is correct |
15 |
Correct |
49 ms |
2672 KB |
Output is correct |
16 |
Correct |
43 ms |
2568 KB |
Output is correct |
17 |
Correct |
43 ms |
2572 KB |
Output is correct |
18 |
Correct |
45 ms |
2528 KB |
Output is correct |
19 |
Correct |
44 ms |
2540 KB |
Output is correct |
20 |
Correct |
46 ms |
2564 KB |
Output is correct |
21 |
Correct |
71 ms |
2748 KB |
Output is correct |
22 |
Correct |
102 ms |
2748 KB |
Output is correct |
23 |
Correct |
107 ms |
2868 KB |
Output is correct |
24 |
Correct |
100 ms |
2868 KB |
Output is correct |
25 |
Correct |
105 ms |
2816 KB |
Output is correct |
26 |
Correct |
97 ms |
2748 KB |
Output is correct |
27 |
Correct |
104 ms |
2824 KB |
Output is correct |
28 |
Correct |
93 ms |
2768 KB |
Output is correct |
29 |
Correct |
156 ms |
2892 KB |
Output is correct |
30 |
Correct |
208 ms |
3092 KB |
Output is correct |
31 |
Correct |
216 ms |
3092 KB |
Output is correct |
32 |
Correct |
200 ms |
3044 KB |
Output is correct |
33 |
Correct |
209 ms |
3072 KB |
Output is correct |
34 |
Correct |
203 ms |
3096 KB |
Output is correct |
35 |
Correct |
204 ms |
3144 KB |
Output is correct |
36 |
Correct |
201 ms |
3008 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2280 KB |
Output is correct |
2 |
Correct |
8 ms |
2100 KB |
Output is correct |
3 |
Correct |
8 ms |
2412 KB |
Output is correct |
4 |
Correct |
8 ms |
2016 KB |
Output is correct |
5 |
Correct |
8 ms |
2324 KB |
Output is correct |
6 |
Correct |
8 ms |
2144 KB |
Output is correct |
7 |
Correct |
10 ms |
2116 KB |
Output is correct |
8 |
Correct |
15 ms |
2132 KB |
Output is correct |
9 |
Correct |
17 ms |
2180 KB |
Output is correct |
10 |
Correct |
17 ms |
1880 KB |
Output is correct |
11 |
Correct |
16 ms |
2304 KB |
Output is correct |
12 |
Correct |
16 ms |
2380 KB |
Output is correct |
13 |
Correct |
16 ms |
2240 KB |
Output is correct |
14 |
Correct |
28 ms |
2496 KB |
Output is correct |
15 |
Correct |
49 ms |
2672 KB |
Output is correct |
16 |
Correct |
43 ms |
2568 KB |
Output is correct |
17 |
Correct |
43 ms |
2572 KB |
Output is correct |
18 |
Correct |
45 ms |
2528 KB |
Output is correct |
19 |
Correct |
44 ms |
2540 KB |
Output is correct |
20 |
Correct |
46 ms |
2564 KB |
Output is correct |
21 |
Correct |
71 ms |
2748 KB |
Output is correct |
22 |
Correct |
102 ms |
2748 KB |
Output is correct |
23 |
Correct |
107 ms |
2868 KB |
Output is correct |
24 |
Correct |
100 ms |
2868 KB |
Output is correct |
25 |
Correct |
105 ms |
2816 KB |
Output is correct |
26 |
Correct |
97 ms |
2748 KB |
Output is correct |
27 |
Correct |
104 ms |
2824 KB |
Output is correct |
28 |
Correct |
93 ms |
2768 KB |
Output is correct |
29 |
Correct |
156 ms |
2892 KB |
Output is correct |
30 |
Correct |
208 ms |
3092 KB |
Output is correct |
31 |
Correct |
216 ms |
3092 KB |
Output is correct |
32 |
Correct |
200 ms |
3044 KB |
Output is correct |
33 |
Correct |
209 ms |
3072 KB |
Output is correct |
34 |
Correct |
203 ms |
3096 KB |
Output is correct |
35 |
Correct |
204 ms |
3144 KB |
Output is correct |
36 |
Correct |
201 ms |
3008 KB |
Output is correct |
37 |
Incorrect |
41 ms |
392 KB |
invalid len |
38 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2280 KB |
Output is correct |
2 |
Correct |
8 ms |
2100 KB |
Output is correct |
3 |
Correct |
8 ms |
2412 KB |
Output is correct |
4 |
Correct |
8 ms |
2016 KB |
Output is correct |
5 |
Correct |
8 ms |
2324 KB |
Output is correct |
6 |
Correct |
8 ms |
2144 KB |
Output is correct |
7 |
Correct |
10 ms |
2116 KB |
Output is correct |
8 |
Correct |
15 ms |
2132 KB |
Output is correct |
9 |
Correct |
17 ms |
2180 KB |
Output is correct |
10 |
Correct |
17 ms |
1880 KB |
Output is correct |
11 |
Correct |
16 ms |
2304 KB |
Output is correct |
12 |
Correct |
16 ms |
2380 KB |
Output is correct |
13 |
Correct |
16 ms |
2240 KB |
Output is correct |
14 |
Correct |
28 ms |
2496 KB |
Output is correct |
15 |
Correct |
49 ms |
2672 KB |
Output is correct |
16 |
Correct |
43 ms |
2568 KB |
Output is correct |
17 |
Correct |
43 ms |
2572 KB |
Output is correct |
18 |
Correct |
45 ms |
2528 KB |
Output is correct |
19 |
Correct |
44 ms |
2540 KB |
Output is correct |
20 |
Correct |
46 ms |
2564 KB |
Output is correct |
21 |
Correct |
71 ms |
2748 KB |
Output is correct |
22 |
Correct |
102 ms |
2748 KB |
Output is correct |
23 |
Correct |
107 ms |
2868 KB |
Output is correct |
24 |
Correct |
100 ms |
2868 KB |
Output is correct |
25 |
Correct |
105 ms |
2816 KB |
Output is correct |
26 |
Correct |
97 ms |
2748 KB |
Output is correct |
27 |
Correct |
104 ms |
2824 KB |
Output is correct |
28 |
Correct |
93 ms |
2768 KB |
Output is correct |
29 |
Correct |
156 ms |
2892 KB |
Output is correct |
30 |
Correct |
208 ms |
3092 KB |
Output is correct |
31 |
Correct |
216 ms |
3092 KB |
Output is correct |
32 |
Correct |
200 ms |
3044 KB |
Output is correct |
33 |
Correct |
209 ms |
3072 KB |
Output is correct |
34 |
Correct |
203 ms |
3096 KB |
Output is correct |
35 |
Correct |
204 ms |
3144 KB |
Output is correct |
36 |
Correct |
201 ms |
3008 KB |
Output is correct |
37 |
Incorrect |
41 ms |
392 KB |
invalid len |
38 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2280 KB |
Output is correct |
2 |
Correct |
8 ms |
2100 KB |
Output is correct |
3 |
Correct |
8 ms |
2412 KB |
Output is correct |
4 |
Correct |
8 ms |
2016 KB |
Output is correct |
5 |
Correct |
8 ms |
2324 KB |
Output is correct |
6 |
Correct |
8 ms |
2144 KB |
Output is correct |
7 |
Correct |
10 ms |
2116 KB |
Output is correct |
8 |
Correct |
15 ms |
2132 KB |
Output is correct |
9 |
Correct |
17 ms |
2180 KB |
Output is correct |
10 |
Correct |
17 ms |
1880 KB |
Output is correct |
11 |
Correct |
16 ms |
2304 KB |
Output is correct |
12 |
Correct |
16 ms |
2380 KB |
Output is correct |
13 |
Correct |
16 ms |
2240 KB |
Output is correct |
14 |
Correct |
28 ms |
2496 KB |
Output is correct |
15 |
Correct |
49 ms |
2672 KB |
Output is correct |
16 |
Correct |
43 ms |
2568 KB |
Output is correct |
17 |
Correct |
43 ms |
2572 KB |
Output is correct |
18 |
Correct |
45 ms |
2528 KB |
Output is correct |
19 |
Correct |
44 ms |
2540 KB |
Output is correct |
20 |
Correct |
46 ms |
2564 KB |
Output is correct |
21 |
Correct |
71 ms |
2748 KB |
Output is correct |
22 |
Correct |
102 ms |
2748 KB |
Output is correct |
23 |
Correct |
107 ms |
2868 KB |
Output is correct |
24 |
Correct |
100 ms |
2868 KB |
Output is correct |
25 |
Correct |
105 ms |
2816 KB |
Output is correct |
26 |
Correct |
97 ms |
2748 KB |
Output is correct |
27 |
Correct |
104 ms |
2824 KB |
Output is correct |
28 |
Correct |
93 ms |
2768 KB |
Output is correct |
29 |
Correct |
156 ms |
2892 KB |
Output is correct |
30 |
Correct |
208 ms |
3092 KB |
Output is correct |
31 |
Correct |
216 ms |
3092 KB |
Output is correct |
32 |
Correct |
200 ms |
3044 KB |
Output is correct |
33 |
Correct |
209 ms |
3072 KB |
Output is correct |
34 |
Correct |
203 ms |
3096 KB |
Output is correct |
35 |
Correct |
204 ms |
3144 KB |
Output is correct |
36 |
Correct |
201 ms |
3008 KB |
Output is correct |
37 |
Incorrect |
41 ms |
392 KB |
invalid len |
38 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2280 KB |
Output is correct |
2 |
Correct |
8 ms |
2100 KB |
Output is correct |
3 |
Correct |
8 ms |
2412 KB |
Output is correct |
4 |
Correct |
8 ms |
2016 KB |
Output is correct |
5 |
Correct |
8 ms |
2324 KB |
Output is correct |
6 |
Correct |
8 ms |
2144 KB |
Output is correct |
7 |
Correct |
10 ms |
2116 KB |
Output is correct |
8 |
Correct |
15 ms |
2132 KB |
Output is correct |
9 |
Correct |
17 ms |
2180 KB |
Output is correct |
10 |
Correct |
17 ms |
1880 KB |
Output is correct |
11 |
Correct |
16 ms |
2304 KB |
Output is correct |
12 |
Correct |
16 ms |
2380 KB |
Output is correct |
13 |
Correct |
16 ms |
2240 KB |
Output is correct |
14 |
Correct |
28 ms |
2496 KB |
Output is correct |
15 |
Correct |
49 ms |
2672 KB |
Output is correct |
16 |
Correct |
43 ms |
2568 KB |
Output is correct |
17 |
Correct |
43 ms |
2572 KB |
Output is correct |
18 |
Correct |
45 ms |
2528 KB |
Output is correct |
19 |
Correct |
44 ms |
2540 KB |
Output is correct |
20 |
Correct |
46 ms |
2564 KB |
Output is correct |
21 |
Correct |
71 ms |
2748 KB |
Output is correct |
22 |
Correct |
102 ms |
2748 KB |
Output is correct |
23 |
Correct |
107 ms |
2868 KB |
Output is correct |
24 |
Correct |
100 ms |
2868 KB |
Output is correct |
25 |
Correct |
105 ms |
2816 KB |
Output is correct |
26 |
Correct |
97 ms |
2748 KB |
Output is correct |
27 |
Correct |
104 ms |
2824 KB |
Output is correct |
28 |
Correct |
93 ms |
2768 KB |
Output is correct |
29 |
Correct |
156 ms |
2892 KB |
Output is correct |
30 |
Correct |
208 ms |
3092 KB |
Output is correct |
31 |
Correct |
216 ms |
3092 KB |
Output is correct |
32 |
Correct |
200 ms |
3044 KB |
Output is correct |
33 |
Correct |
209 ms |
3072 KB |
Output is correct |
34 |
Correct |
203 ms |
3096 KB |
Output is correct |
35 |
Correct |
204 ms |
3144 KB |
Output is correct |
36 |
Correct |
201 ms |
3008 KB |
Output is correct |
37 |
Incorrect |
41 ms |
392 KB |
invalid len |
38 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2280 KB |
Output is correct |
2 |
Correct |
8 ms |
2100 KB |
Output is correct |
3 |
Correct |
8 ms |
2412 KB |
Output is correct |
4 |
Correct |
8 ms |
2016 KB |
Output is correct |
5 |
Correct |
8 ms |
2324 KB |
Output is correct |
6 |
Correct |
8 ms |
2144 KB |
Output is correct |
7 |
Correct |
10 ms |
2116 KB |
Output is correct |
8 |
Correct |
15 ms |
2132 KB |
Output is correct |
9 |
Correct |
17 ms |
2180 KB |
Output is correct |
10 |
Correct |
17 ms |
1880 KB |
Output is correct |
11 |
Correct |
16 ms |
2304 KB |
Output is correct |
12 |
Correct |
16 ms |
2380 KB |
Output is correct |
13 |
Correct |
16 ms |
2240 KB |
Output is correct |
14 |
Correct |
28 ms |
2496 KB |
Output is correct |
15 |
Correct |
49 ms |
2672 KB |
Output is correct |
16 |
Correct |
43 ms |
2568 KB |
Output is correct |
17 |
Correct |
43 ms |
2572 KB |
Output is correct |
18 |
Correct |
45 ms |
2528 KB |
Output is correct |
19 |
Correct |
44 ms |
2540 KB |
Output is correct |
20 |
Correct |
46 ms |
2564 KB |
Output is correct |
21 |
Correct |
71 ms |
2748 KB |
Output is correct |
22 |
Correct |
102 ms |
2748 KB |
Output is correct |
23 |
Correct |
107 ms |
2868 KB |
Output is correct |
24 |
Correct |
100 ms |
2868 KB |
Output is correct |
25 |
Correct |
105 ms |
2816 KB |
Output is correct |
26 |
Correct |
97 ms |
2748 KB |
Output is correct |
27 |
Correct |
104 ms |
2824 KB |
Output is correct |
28 |
Correct |
93 ms |
2768 KB |
Output is correct |
29 |
Correct |
156 ms |
2892 KB |
Output is correct |
30 |
Correct |
208 ms |
3092 KB |
Output is correct |
31 |
Correct |
216 ms |
3092 KB |
Output is correct |
32 |
Correct |
200 ms |
3044 KB |
Output is correct |
33 |
Correct |
209 ms |
3072 KB |
Output is correct |
34 |
Correct |
203 ms |
3096 KB |
Output is correct |
35 |
Correct |
204 ms |
3144 KB |
Output is correct |
36 |
Correct |
201 ms |
3008 KB |
Output is correct |
37 |
Incorrect |
41 ms |
392 KB |
invalid len |
38 |
Halted |
0 ms |
0 KB |
- |