# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
727732 |
2023-04-21T08:01:17 Z |
anusha777 |
Mars (APIO22_mars) |
C++17 |
|
0 ms |
0 KB |
#include "mars.h"
#include <bits/stdc++.h>
#define fast ios::sync_with_stdio(0); cin.tie(NULL);cout.tie(NULL)
#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++)
const int N=1e5+1, mod=998244353, inf=1e18+1;
using namespace std;
string process(vvs 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(i, 0, 4)
{
int xt= t.f+dx[i], yt= t.s+ dy[i];
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;
return string(100, '0');
}
Compilation message
/usr/bin/ld: /tmp/cciw0XvG.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