#include "mars.h"
#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i < b; i++)
#define F first
#define S second
using namespace std;
int solve(string s, int len) {
vector<vector<char>> g(len, vector<char>(len));
For(i, 0, len) For(j, 0, len) {
g[i][j] = s[i * len + j];
}
int cnt = 0;
const int dx[4] = {0, 0, 1, -1};
const int dy[4] = {1, -1, 0, 0};
For(i, 0, len) For(j, 0, len) if(g[i][j] == '1') {
cnt++;
queue<pair<int, int>> q;
g[i][j] = '0';
q.push({i, j});
while(!q.empty()) {
int x, y;
tie(x, y) = q.front(); q.pop();
For(it, 0, 4) {
int nx = x + dx[it];
int ny = y + dy[it];
if(nx < 0 || ny < 0 || nx >= len || ny >= len) continue;
if(g[nx][ny] != '1') continue;
g[nx][ny] = '0';
q.push({nx, ny});
}
}
}
return cnt;
}
string process(vector<vector<string>> a, int I, int J, int k, int n) {
int len = k * 2 + 3;
string res;
For(i, 0, 100) res.push_back('0');
int l2 = k * 2 + 1;
For(i, 0, 3) For(j, 0, 3) {
For(i2, 0, l2) For(j2, 0, l2) {
res[(i + i2) * len + (j + j2)] = a[i][j][i2 * l2 + j2];
}
}
if(k == n - 1) {
int ans = solve(res, len);
For(i, 0, 100) res[i] = '0';
For(i, 0, 11) res[i] = (char)('0' + ((ans & (1 << i)) != 0));
}
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1952 KB |
Output is correct |
2 |
Correct |
8 ms |
2132 KB |
Output is correct |
3 |
Correct |
8 ms |
2224 KB |
Output is correct |
4 |
Correct |
8 ms |
2004 KB |
Output is correct |
5 |
Correct |
8 ms |
2028 KB |
Output is correct |
6 |
Correct |
8 ms |
2140 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1952 KB |
Output is correct |
2 |
Correct |
8 ms |
2132 KB |
Output is correct |
3 |
Correct |
8 ms |
2224 KB |
Output is correct |
4 |
Correct |
8 ms |
2004 KB |
Output is correct |
5 |
Correct |
8 ms |
2028 KB |
Output is correct |
6 |
Correct |
8 ms |
2140 KB |
Output is correct |
7 |
Correct |
10 ms |
1856 KB |
Output is correct |
8 |
Correct |
16 ms |
1860 KB |
Output is correct |
9 |
Correct |
17 ms |
2132 KB |
Output is correct |
10 |
Correct |
16 ms |
2140 KB |
Output is correct |
11 |
Correct |
16 ms |
2188 KB |
Output is correct |
12 |
Correct |
16 ms |
1748 KB |
Output is correct |
13 |
Correct |
16 ms |
2104 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1952 KB |
Output is correct |
2 |
Correct |
8 ms |
2132 KB |
Output is correct |
3 |
Correct |
8 ms |
2224 KB |
Output is correct |
4 |
Correct |
8 ms |
2004 KB |
Output is correct |
5 |
Correct |
8 ms |
2028 KB |
Output is correct |
6 |
Correct |
8 ms |
2140 KB |
Output is correct |
7 |
Correct |
10 ms |
1856 KB |
Output is correct |
8 |
Correct |
16 ms |
1860 KB |
Output is correct |
9 |
Correct |
17 ms |
2132 KB |
Output is correct |
10 |
Correct |
16 ms |
2140 KB |
Output is correct |
11 |
Correct |
16 ms |
2188 KB |
Output is correct |
12 |
Correct |
16 ms |
1748 KB |
Output is correct |
13 |
Correct |
16 ms |
2104 KB |
Output is correct |
14 |
Incorrect |
4 ms |
200 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1952 KB |
Output is correct |
2 |
Correct |
8 ms |
2132 KB |
Output is correct |
3 |
Correct |
8 ms |
2224 KB |
Output is correct |
4 |
Correct |
8 ms |
2004 KB |
Output is correct |
5 |
Correct |
8 ms |
2028 KB |
Output is correct |
6 |
Correct |
8 ms |
2140 KB |
Output is correct |
7 |
Correct |
10 ms |
1856 KB |
Output is correct |
8 |
Correct |
16 ms |
1860 KB |
Output is correct |
9 |
Correct |
17 ms |
2132 KB |
Output is correct |
10 |
Correct |
16 ms |
2140 KB |
Output is correct |
11 |
Correct |
16 ms |
2188 KB |
Output is correct |
12 |
Correct |
16 ms |
1748 KB |
Output is correct |
13 |
Correct |
16 ms |
2104 KB |
Output is correct |
14 |
Incorrect |
4 ms |
200 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1952 KB |
Output is correct |
2 |
Correct |
8 ms |
2132 KB |
Output is correct |
3 |
Correct |
8 ms |
2224 KB |
Output is correct |
4 |
Correct |
8 ms |
2004 KB |
Output is correct |
5 |
Correct |
8 ms |
2028 KB |
Output is correct |
6 |
Correct |
8 ms |
2140 KB |
Output is correct |
7 |
Correct |
10 ms |
1856 KB |
Output is correct |
8 |
Correct |
16 ms |
1860 KB |
Output is correct |
9 |
Correct |
17 ms |
2132 KB |
Output is correct |
10 |
Correct |
16 ms |
2140 KB |
Output is correct |
11 |
Correct |
16 ms |
2188 KB |
Output is correct |
12 |
Correct |
16 ms |
1748 KB |
Output is correct |
13 |
Correct |
16 ms |
2104 KB |
Output is correct |
14 |
Incorrect |
4 ms |
200 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1952 KB |
Output is correct |
2 |
Correct |
8 ms |
2132 KB |
Output is correct |
3 |
Correct |
8 ms |
2224 KB |
Output is correct |
4 |
Correct |
8 ms |
2004 KB |
Output is correct |
5 |
Correct |
8 ms |
2028 KB |
Output is correct |
6 |
Correct |
8 ms |
2140 KB |
Output is correct |
7 |
Correct |
10 ms |
1856 KB |
Output is correct |
8 |
Correct |
16 ms |
1860 KB |
Output is correct |
9 |
Correct |
17 ms |
2132 KB |
Output is correct |
10 |
Correct |
16 ms |
2140 KB |
Output is correct |
11 |
Correct |
16 ms |
2188 KB |
Output is correct |
12 |
Correct |
16 ms |
1748 KB |
Output is correct |
13 |
Correct |
16 ms |
2104 KB |
Output is correct |
14 |
Incorrect |
4 ms |
200 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1952 KB |
Output is correct |
2 |
Correct |
8 ms |
2132 KB |
Output is correct |
3 |
Correct |
8 ms |
2224 KB |
Output is correct |
4 |
Correct |
8 ms |
2004 KB |
Output is correct |
5 |
Correct |
8 ms |
2028 KB |
Output is correct |
6 |
Correct |
8 ms |
2140 KB |
Output is correct |
7 |
Correct |
10 ms |
1856 KB |
Output is correct |
8 |
Correct |
16 ms |
1860 KB |
Output is correct |
9 |
Correct |
17 ms |
2132 KB |
Output is correct |
10 |
Correct |
16 ms |
2140 KB |
Output is correct |
11 |
Correct |
16 ms |
2188 KB |
Output is correct |
12 |
Correct |
16 ms |
1748 KB |
Output is correct |
13 |
Correct |
16 ms |
2104 KB |
Output is correct |
14 |
Incorrect |
4 ms |
200 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1952 KB |
Output is correct |
2 |
Correct |
8 ms |
2132 KB |
Output is correct |
3 |
Correct |
8 ms |
2224 KB |
Output is correct |
4 |
Correct |
8 ms |
2004 KB |
Output is correct |
5 |
Correct |
8 ms |
2028 KB |
Output is correct |
6 |
Correct |
8 ms |
2140 KB |
Output is correct |
7 |
Correct |
10 ms |
1856 KB |
Output is correct |
8 |
Correct |
16 ms |
1860 KB |
Output is correct |
9 |
Correct |
17 ms |
2132 KB |
Output is correct |
10 |
Correct |
16 ms |
2140 KB |
Output is correct |
11 |
Correct |
16 ms |
2188 KB |
Output is correct |
12 |
Correct |
16 ms |
1748 KB |
Output is correct |
13 |
Correct |
16 ms |
2104 KB |
Output is correct |
14 |
Incorrect |
4 ms |
200 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1952 KB |
Output is correct |
2 |
Correct |
8 ms |
2132 KB |
Output is correct |
3 |
Correct |
8 ms |
2224 KB |
Output is correct |
4 |
Correct |
8 ms |
2004 KB |
Output is correct |
5 |
Correct |
8 ms |
2028 KB |
Output is correct |
6 |
Correct |
8 ms |
2140 KB |
Output is correct |
7 |
Correct |
10 ms |
1856 KB |
Output is correct |
8 |
Correct |
16 ms |
1860 KB |
Output is correct |
9 |
Correct |
17 ms |
2132 KB |
Output is correct |
10 |
Correct |
16 ms |
2140 KB |
Output is correct |
11 |
Correct |
16 ms |
2188 KB |
Output is correct |
12 |
Correct |
16 ms |
1748 KB |
Output is correct |
13 |
Correct |
16 ms |
2104 KB |
Output is correct |
14 |
Incorrect |
4 ms |
200 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1952 KB |
Output is correct |
2 |
Correct |
8 ms |
2132 KB |
Output is correct |
3 |
Correct |
8 ms |
2224 KB |
Output is correct |
4 |
Correct |
8 ms |
2004 KB |
Output is correct |
5 |
Correct |
8 ms |
2028 KB |
Output is correct |
6 |
Correct |
8 ms |
2140 KB |
Output is correct |
7 |
Correct |
10 ms |
1856 KB |
Output is correct |
8 |
Correct |
16 ms |
1860 KB |
Output is correct |
9 |
Correct |
17 ms |
2132 KB |
Output is correct |
10 |
Correct |
16 ms |
2140 KB |
Output is correct |
11 |
Correct |
16 ms |
2188 KB |
Output is correct |
12 |
Correct |
16 ms |
1748 KB |
Output is correct |
13 |
Correct |
16 ms |
2104 KB |
Output is correct |
14 |
Incorrect |
4 ms |
200 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |