#include "mars.h"
#include<bits/stdc++.h>
#define pb push_back
#define ll long long int
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long int>
#define vvll vector<vector<long long int>>
#define pii pair<int, int>
#define vpii vector<pair<int, int>>
#define vpll vector<pair<long long int, long long int>>
#define pqpll priority_queue<pair<long long int, long long int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define mii map<int,int>
#define mll map<long long int, long long int>
#define mivi map<int,vector<int>>
#define f0r(i,n) for(int i=0;i<n;i++)
#define FOR(i,k,n) for(int i=k;i<n;i++)
using namespace std;
std::string process(std::vector <std::vector<std::string>> a, int i, int j, int k, int n)
{
string ret;
if(k == 0){
f0r(ii, 100)ret += '0';
f0r(ii, 3){
f0r(jj, 3){
ret[(i + ii) * (2*n+1) + (j + jj)] = a[ii][jj][0];
}
}
}
else{
ret = a[0][0];
f0r(ii, 3){
f0r(jj, 3){
f0r(cur, 100){
if(a[ii][jj][cur] == '1')ret[cur] = '1';
}
}
}
}
if(k == n-1){
//cout<<ret<<'\n';
int grid[2*n+1][2*n+1];
f0r(ii, 2*n+1){
f0r(jj, 2*n+1){
grid[ii][jj] = ret[ii * (2 * n + 1) + jj] - '0';
}
}
queue<pair<int,int>>q;
bool vis[2*n+1][2*n+1];
f0r(ii, 2*n+1)f0r(jj, 2*n+1)vis[ii][jj] = 0;
int ccs = 0;
f0r(ii, 2*n+1){
f0r(jj, 2*n+1){
if(grid[ii][jj] == 1 && !vis[ii][jj]){
ccs++;
q.push({ii, jj});
vis[ii][jj] = 1;
while(!q.empty()){
pii cur = q.front();
q.pop();
vpii nxt;
int a = cur.first;
int b = cur.second;
if(a != 0 && grid[a-1][b] == 1)nxt.pb({a-1, b});
if(a != 2*n && grid[a+1][b] == 1)nxt.pb({a+1, b});
if(b != 0 && grid[a][b-1] == 1)nxt.pb({a, b-1});
if(b != 2*n && grid[a][b+1] == 1)nxt.pb({a, b+1});
for(pii u : nxt){
if(vis[u.first][u.second])continue;
vis[u.first][u.second] = 1;
q.push({u.first, u.second});
}
}
}
}
}
//cout<<ccs<<'\n';
string ans = "";
f0r(ii, 20){
if(ccs & (1<<ii))ans += '1';
else ans+='0';
}
f0r(ii, 80)ans+='0';
return ans;
}
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
3700 KB |
Output is correct |
2 |
Correct |
6 ms |
3764 KB |
Output is correct |
3 |
Correct |
5 ms |
4108 KB |
Output is correct |
4 |
Correct |
6 ms |
4028 KB |
Output is correct |
5 |
Correct |
4 ms |
4380 KB |
Output is correct |
6 |
Correct |
8 ms |
3956 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
3700 KB |
Output is correct |
2 |
Correct |
6 ms |
3764 KB |
Output is correct |
3 |
Correct |
5 ms |
4108 KB |
Output is correct |
4 |
Correct |
6 ms |
4028 KB |
Output is correct |
5 |
Correct |
4 ms |
4380 KB |
Output is correct |
6 |
Correct |
8 ms |
3956 KB |
Output is correct |
7 |
Correct |
8 ms |
4308 KB |
Output is correct |
8 |
Correct |
12 ms |
4456 KB |
Output is correct |
9 |
Correct |
8 ms |
4288 KB |
Output is correct |
10 |
Correct |
9 ms |
3960 KB |
Output is correct |
11 |
Correct |
8 ms |
3976 KB |
Output is correct |
12 |
Correct |
9 ms |
4132 KB |
Output is correct |
13 |
Correct |
8 ms |
3800 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
3700 KB |
Output is correct |
2 |
Correct |
6 ms |
3764 KB |
Output is correct |
3 |
Correct |
5 ms |
4108 KB |
Output is correct |
4 |
Correct |
6 ms |
4028 KB |
Output is correct |
5 |
Correct |
4 ms |
4380 KB |
Output is correct |
6 |
Correct |
8 ms |
3956 KB |
Output is correct |
7 |
Correct |
8 ms |
4308 KB |
Output is correct |
8 |
Correct |
12 ms |
4456 KB |
Output is correct |
9 |
Correct |
8 ms |
4288 KB |
Output is correct |
10 |
Correct |
9 ms |
3960 KB |
Output is correct |
11 |
Correct |
8 ms |
3976 KB |
Output is correct |
12 |
Correct |
9 ms |
4132 KB |
Output is correct |
13 |
Correct |
8 ms |
3800 KB |
Output is correct |
14 |
Runtime error |
2 ms |
440 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
3700 KB |
Output is correct |
2 |
Correct |
6 ms |
3764 KB |
Output is correct |
3 |
Correct |
5 ms |
4108 KB |
Output is correct |
4 |
Correct |
6 ms |
4028 KB |
Output is correct |
5 |
Correct |
4 ms |
4380 KB |
Output is correct |
6 |
Correct |
8 ms |
3956 KB |
Output is correct |
7 |
Correct |
8 ms |
4308 KB |
Output is correct |
8 |
Correct |
12 ms |
4456 KB |
Output is correct |
9 |
Correct |
8 ms |
4288 KB |
Output is correct |
10 |
Correct |
9 ms |
3960 KB |
Output is correct |
11 |
Correct |
8 ms |
3976 KB |
Output is correct |
12 |
Correct |
9 ms |
4132 KB |
Output is correct |
13 |
Correct |
8 ms |
3800 KB |
Output is correct |
14 |
Runtime error |
2 ms |
440 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
3700 KB |
Output is correct |
2 |
Correct |
6 ms |
3764 KB |
Output is correct |
3 |
Correct |
5 ms |
4108 KB |
Output is correct |
4 |
Correct |
6 ms |
4028 KB |
Output is correct |
5 |
Correct |
4 ms |
4380 KB |
Output is correct |
6 |
Correct |
8 ms |
3956 KB |
Output is correct |
7 |
Correct |
8 ms |
4308 KB |
Output is correct |
8 |
Correct |
12 ms |
4456 KB |
Output is correct |
9 |
Correct |
8 ms |
4288 KB |
Output is correct |
10 |
Correct |
9 ms |
3960 KB |
Output is correct |
11 |
Correct |
8 ms |
3976 KB |
Output is correct |
12 |
Correct |
9 ms |
4132 KB |
Output is correct |
13 |
Correct |
8 ms |
3800 KB |
Output is correct |
14 |
Runtime error |
2 ms |
440 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
3700 KB |
Output is correct |
2 |
Correct |
6 ms |
3764 KB |
Output is correct |
3 |
Correct |
5 ms |
4108 KB |
Output is correct |
4 |
Correct |
6 ms |
4028 KB |
Output is correct |
5 |
Correct |
4 ms |
4380 KB |
Output is correct |
6 |
Correct |
8 ms |
3956 KB |
Output is correct |
7 |
Correct |
8 ms |
4308 KB |
Output is correct |
8 |
Correct |
12 ms |
4456 KB |
Output is correct |
9 |
Correct |
8 ms |
4288 KB |
Output is correct |
10 |
Correct |
9 ms |
3960 KB |
Output is correct |
11 |
Correct |
8 ms |
3976 KB |
Output is correct |
12 |
Correct |
9 ms |
4132 KB |
Output is correct |
13 |
Correct |
8 ms |
3800 KB |
Output is correct |
14 |
Runtime error |
2 ms |
440 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
3700 KB |
Output is correct |
2 |
Correct |
6 ms |
3764 KB |
Output is correct |
3 |
Correct |
5 ms |
4108 KB |
Output is correct |
4 |
Correct |
6 ms |
4028 KB |
Output is correct |
5 |
Correct |
4 ms |
4380 KB |
Output is correct |
6 |
Correct |
8 ms |
3956 KB |
Output is correct |
7 |
Correct |
8 ms |
4308 KB |
Output is correct |
8 |
Correct |
12 ms |
4456 KB |
Output is correct |
9 |
Correct |
8 ms |
4288 KB |
Output is correct |
10 |
Correct |
9 ms |
3960 KB |
Output is correct |
11 |
Correct |
8 ms |
3976 KB |
Output is correct |
12 |
Correct |
9 ms |
4132 KB |
Output is correct |
13 |
Correct |
8 ms |
3800 KB |
Output is correct |
14 |
Runtime error |
2 ms |
440 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
3700 KB |
Output is correct |
2 |
Correct |
6 ms |
3764 KB |
Output is correct |
3 |
Correct |
5 ms |
4108 KB |
Output is correct |
4 |
Correct |
6 ms |
4028 KB |
Output is correct |
5 |
Correct |
4 ms |
4380 KB |
Output is correct |
6 |
Correct |
8 ms |
3956 KB |
Output is correct |
7 |
Correct |
8 ms |
4308 KB |
Output is correct |
8 |
Correct |
12 ms |
4456 KB |
Output is correct |
9 |
Correct |
8 ms |
4288 KB |
Output is correct |
10 |
Correct |
9 ms |
3960 KB |
Output is correct |
11 |
Correct |
8 ms |
3976 KB |
Output is correct |
12 |
Correct |
9 ms |
4132 KB |
Output is correct |
13 |
Correct |
8 ms |
3800 KB |
Output is correct |
14 |
Runtime error |
2 ms |
440 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
3700 KB |
Output is correct |
2 |
Correct |
6 ms |
3764 KB |
Output is correct |
3 |
Correct |
5 ms |
4108 KB |
Output is correct |
4 |
Correct |
6 ms |
4028 KB |
Output is correct |
5 |
Correct |
4 ms |
4380 KB |
Output is correct |
6 |
Correct |
8 ms |
3956 KB |
Output is correct |
7 |
Correct |
8 ms |
4308 KB |
Output is correct |
8 |
Correct |
12 ms |
4456 KB |
Output is correct |
9 |
Correct |
8 ms |
4288 KB |
Output is correct |
10 |
Correct |
9 ms |
3960 KB |
Output is correct |
11 |
Correct |
8 ms |
3976 KB |
Output is correct |
12 |
Correct |
9 ms |
4132 KB |
Output is correct |
13 |
Correct |
8 ms |
3800 KB |
Output is correct |
14 |
Runtime error |
2 ms |
440 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
3700 KB |
Output is correct |
2 |
Correct |
6 ms |
3764 KB |
Output is correct |
3 |
Correct |
5 ms |
4108 KB |
Output is correct |
4 |
Correct |
6 ms |
4028 KB |
Output is correct |
5 |
Correct |
4 ms |
4380 KB |
Output is correct |
6 |
Correct |
8 ms |
3956 KB |
Output is correct |
7 |
Correct |
8 ms |
4308 KB |
Output is correct |
8 |
Correct |
12 ms |
4456 KB |
Output is correct |
9 |
Correct |
8 ms |
4288 KB |
Output is correct |
10 |
Correct |
9 ms |
3960 KB |
Output is correct |
11 |
Correct |
8 ms |
3976 KB |
Output is correct |
12 |
Correct |
9 ms |
4132 KB |
Output is correct |
13 |
Correct |
8 ms |
3800 KB |
Output is correct |
14 |
Runtime error |
2 ms |
440 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |