#include "mars.h"
#include <bits/stdc++.h>
using namespace std;
// #define int long long
#define f0(i, n) for(int i = 0; i < (n); i++)
#define f1(i, n) for(int i = 1; i <= (n); i++)
#define ff first
#define ss second
vector<vector<bool>> grph, vis;
std::string process(std::vector <std::vector<std::string>> a, int i, int j, int k, int n)
{
if(
(i == 0) &&
(j == 0) &&
(k == 0)
) {
vector<bool> row(2*n+1, 0);
grph.resize(2*n+1, row);
vis.resize(2*n+1, row);
}
if(a[0][0][0] == '1') grph[i][j] = 1;
if(a[0][1][0] == '1') grph[i][j+1] = 1;
if(a[0][2][0] == '1') grph[i][j+2] = 1;
if(a[1][0][0] == '1') grph[i+1][j] = 1;
if(a[1][1][0] == '1') grph[i+1][j+1] = 1;
if(a[1][2][0] == '1') grph[i+1][j+2] = 1;
if(a[2][0][0] == '1') grph[i+2][j] = 1;
if(a[2][1][0] == '1') grph[i+2][j+1] = 1;
if(a[2][2][0] == '1') grph[i+2][j+2] = 1;
if(k == (n-1)) {
int cnt = 0;
queue<pair<int, int>> q;
f0(i, 2*n+1) {
f0(j, 2*n+1) {
// cout << grph[i][j] << " ";
if(!grph[i][j]) continue;
if(vis[i][j]) continue;
vis[i][j] = 1;
cnt++;
q.push({i, j});
while(!q.empty()) {
auto cur = q.front();
int x = cur.ff, y = cur.ss;
// if(vis[x][y]) continue;
q.pop();
if(x+1 < 2*n+1) {
if(grph[x+1][y] == 1) {
if(!vis[x+1][y]) {
vis[x+1][y] = 1;
q.push({x+1, y});
}
}
}
if(y+1 < 2*n+1) {
if(grph[x][y+1] == 1) {
if(!vis[x][y+1]) {
vis[x][y+1] = 1;
q.push({x, y+1});
}
}
}
if(x > 0) {
if(grph[x-1][y] == 1) {
if(!vis[x-1][y]) {
vis[x-1][y] = 1;
q.push({x-1, y});
}
}
}
if(y > 0) {
if(grph[x][y-1] == 1) {
if(!vis[x][y-1]) {
vis[x][y-1] = 1;
q.push({x, y-1});
}
}
}
}
}
// cout << endl;
}
// cout << cnt << "\n";
string res = "";
while(cnt > 0) {
res += '0' + (cnt%2);
cnt /= 2;
}
// res = string(res.rbegin(), res.rend());
int nn = res.size();
// string res0;
f0(i, 100-nn) res += '0';
// cout << res0+res << endl;
return res;
}
return a[0][0];
return std::string(100 ,'0');
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
328 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
328 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
328 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
328 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
328 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
328 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
328 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
328 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
328 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
328 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |