# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
727736 |
2023-04-21T08:15:13 Z |
anusha777 |
Mars (APIO22_mars) |
C++17 |
|
0 ms |
0 KB |
#include "mars.h"
#include <bits/stdc++.h>
#define sz(x) (int)((x).size())
#define pb push_back
#define vi vector<int>
#define vb vector<bool>
#define vvb vector<vb>
#define pi pair<int,int>
#define vpi vector<pi>
#define vvi vector<vi>
#define vvs vector <vector<string>>
#define vc vector<char>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pbb() pop_back()
#define f first
#define s second
#define ll long long
#define int long long
#define ull unsigned long long
#define line cout<<"_____________________________"<<endl;
#define forr(i, a, b) for(int i=a; i<b; i++)
using namespace std;
string process(vector <vector<string>> a, int x, int y, int kk, int n)
{
if(kk==0)
{
string s;
forr(i, 0, 3) forr(j, 0, 3) s.pb(a[i][j][0]);
forr(i , 9, 100) s.pb('0');
return s;
}
vvb vis(5, vb(5));
vvi g(5, vi(5));
vi dx={0, 1, 0, -1}, dy={1, 0, -1, 0};
forr(i, 0, 3) forr(j, 0, 3) forr(k, 0, 9)
{
int ii= i + k%3, jj= j+ k/3;
g[ii][jj]= a[i][j][k]-'0';
}
int total=0;
forr(i, 0, 5) forr(j, 0, 5) if(!vis[i][j] and g[i][j]==1)
{
queue<pi> q;
q.push({i, j});
while(!q.empty())
{
pi t= q.front();
q.pop();
if(vis[t.f][t.s]) continue;
vis[t.f][t.s]=1;
forr(k, 0, 4)
{
int xt= t.f+dx[k], yt= t.s+ dy[k];
if(xt>=0 and xt<5 and yt>=0 and yt<5) if(!vis[xt][yt] and g[xt][yt]==1)
q.push({xt, yt});
}
}
total++;
}
string ans;
for(int i=0 , mask=1; i<100; i++, mask*=2)
{
if((total&mask)==mask) ans.pb('1');
else ans.pb('0');
}
return ans;
}
Compilation message
/usr/bin/ld: /tmp/cc5VXJZ9.o: in function `main':
stub.cpp:(.text.startup+0x793): undefined reference to `process(std::vector<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::allocator<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >, int, int, int, int)'
collect2: error: ld returned 1 exit status