#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define fastio ios::sync_with_stdio(false), cin.tie(0)
#define pb push_back
#define eb emplace_back
#define f first
#define s second
#include "mars.h"
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
string solve(string s, int n){
auto inbound = [&](int x, int y) -> bool {
return x >= 0 && y >= 0 && x < 2 * n + 1 && y < 2 * n + 1;
};
int ans = 0;
vector<vector<int>> vis(10, vector<int>(10));
auto dfs = [&](auto dfs, int x, int y) -> void {
for(int d = 0; d < 4; d++){
int xx = x + dx[d], yy = y + dy[d];
if(!inbound(xx, yy) || s[xx * 10 + yy] == '0' || vis[xx][yy]) continue;
vis[xx][yy] = 1;
dfs(dfs, xx, yy);
}
};
for(int i = 0; i < 10; i++){
for(int j = 0; j < 10; j++){
if(s[i * 10 + j] == '0' || vis[i][j]) continue;
ans++;
vis[i][j] = 1;
dfs(dfs, i, j);
}
}
string ret = "";
for(int i = 0; i < 30; i++){
if(ans & (1 << i)) ret += '1';
else ret += '0';
}
for(int i = 0; i < 70; i++) ret += '0';
return ret;
}
std::string process(std::vector <std::vector<std::string>> a, int i, int j, int k, int n){
if(n <= 4){
vector<vector<int>> st(10, vector<int>(10));
for(int dx = 0; dx < 3; dx++){
for(int dy = 0; dy < 3; dy++){
for(int c = 0; c < 10; c++){
for(int d = 0; d < 10; d++){
if(i + dx + c > 2 * n || j + dy + d > 2 * n) break;
if(a[dx][dy][c * 10 + d] == '1') st[dx + c][dy + d] = 1;
}
}
}
}
a[i][j] = "";
for(int c = 0; c < 10; c++){
for(int d = 0; d < 10; d++){
if(st[c][d]) a[i][j] += '1';
else a[i][j] += '0';
}
}
if(i == 0 && j == 0 && k == n - 1){
return solve(a[0][0], n);
}
return a[i][j];
}
}
Compilation message
mars.cpp: In function 'std::string process(std::vector<std::vector<std::__cxx11::basic_string<char> > >, int, int, int, int)':
mars.cpp:70:1: warning: control reaches end of non-void function [-Wreturn-type]
70 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
4292 KB |
Output is correct |
2 |
Correct |
7 ms |
3620 KB |
Output is correct |
3 |
Correct |
6 ms |
3952 KB |
Output is correct |
4 |
Correct |
5 ms |
3784 KB |
Output is correct |
5 |
Correct |
11 ms |
3944 KB |
Output is correct |
6 |
Correct |
6 ms |
4552 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
4292 KB |
Output is correct |
2 |
Correct |
7 ms |
3620 KB |
Output is correct |
3 |
Correct |
6 ms |
3952 KB |
Output is correct |
4 |
Correct |
5 ms |
3784 KB |
Output is correct |
5 |
Correct |
11 ms |
3944 KB |
Output is correct |
6 |
Correct |
6 ms |
4552 KB |
Output is correct |
7 |
Runtime error |
1 ms |
352 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
4292 KB |
Output is correct |
2 |
Correct |
7 ms |
3620 KB |
Output is correct |
3 |
Correct |
6 ms |
3952 KB |
Output is correct |
4 |
Correct |
5 ms |
3784 KB |
Output is correct |
5 |
Correct |
11 ms |
3944 KB |
Output is correct |
6 |
Correct |
6 ms |
4552 KB |
Output is correct |
7 |
Runtime error |
1 ms |
352 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
4292 KB |
Output is correct |
2 |
Correct |
7 ms |
3620 KB |
Output is correct |
3 |
Correct |
6 ms |
3952 KB |
Output is correct |
4 |
Correct |
5 ms |
3784 KB |
Output is correct |
5 |
Correct |
11 ms |
3944 KB |
Output is correct |
6 |
Correct |
6 ms |
4552 KB |
Output is correct |
7 |
Runtime error |
1 ms |
352 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
4292 KB |
Output is correct |
2 |
Correct |
7 ms |
3620 KB |
Output is correct |
3 |
Correct |
6 ms |
3952 KB |
Output is correct |
4 |
Correct |
5 ms |
3784 KB |
Output is correct |
5 |
Correct |
11 ms |
3944 KB |
Output is correct |
6 |
Correct |
6 ms |
4552 KB |
Output is correct |
7 |
Runtime error |
1 ms |
352 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
4292 KB |
Output is correct |
2 |
Correct |
7 ms |
3620 KB |
Output is correct |
3 |
Correct |
6 ms |
3952 KB |
Output is correct |
4 |
Correct |
5 ms |
3784 KB |
Output is correct |
5 |
Correct |
11 ms |
3944 KB |
Output is correct |
6 |
Correct |
6 ms |
4552 KB |
Output is correct |
7 |
Runtime error |
1 ms |
352 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
4292 KB |
Output is correct |
2 |
Correct |
7 ms |
3620 KB |
Output is correct |
3 |
Correct |
6 ms |
3952 KB |
Output is correct |
4 |
Correct |
5 ms |
3784 KB |
Output is correct |
5 |
Correct |
11 ms |
3944 KB |
Output is correct |
6 |
Correct |
6 ms |
4552 KB |
Output is correct |
7 |
Runtime error |
1 ms |
352 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
4292 KB |
Output is correct |
2 |
Correct |
7 ms |
3620 KB |
Output is correct |
3 |
Correct |
6 ms |
3952 KB |
Output is correct |
4 |
Correct |
5 ms |
3784 KB |
Output is correct |
5 |
Correct |
11 ms |
3944 KB |
Output is correct |
6 |
Correct |
6 ms |
4552 KB |
Output is correct |
7 |
Runtime error |
1 ms |
352 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
4292 KB |
Output is correct |
2 |
Correct |
7 ms |
3620 KB |
Output is correct |
3 |
Correct |
6 ms |
3952 KB |
Output is correct |
4 |
Correct |
5 ms |
3784 KB |
Output is correct |
5 |
Correct |
11 ms |
3944 KB |
Output is correct |
6 |
Correct |
6 ms |
4552 KB |
Output is correct |
7 |
Runtime error |
1 ms |
352 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
4292 KB |
Output is correct |
2 |
Correct |
7 ms |
3620 KB |
Output is correct |
3 |
Correct |
6 ms |
3952 KB |
Output is correct |
4 |
Correct |
5 ms |
3784 KB |
Output is correct |
5 |
Correct |
11 ms |
3944 KB |
Output is correct |
6 |
Correct |
6 ms |
4552 KB |
Output is correct |
7 |
Runtime error |
1 ms |
352 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |