#define OLC_PGE_APPLICATION #include "pixelGameEngine.h" #include "olcutils.h" using namespace olc; std::mapblocks; std::maptrappedBlocks; int minX=0,maxX=0,minY=0,maxY=0,minZ=0,maxZ=0; bool escape(int x,int y,int z,std::mapvisited){ visited[std::to_string(x)+"_"+std::to_string(y)+"_"+std::to_string(z)]=true; if (x<=minX||x>=maxX||y<=minY||y>=maxY||z<=minZ||z>=maxZ){ return true; } else { if (blocks.find(std::to_string(x)+"_"+std::to_string(y)+"_"+std::to_string(z))!=blocks.end()){ return false; } if (visited.find(std::to_string(x+1)+"_"+std::to_string(y)+"_"+std::to_string(z))==visited.end()&&escape(x+1,y,z,visited)|| visited.find(std::to_string(x-1)+"_"+std::to_string(y)+"_"+std::to_string(z))==visited.end()&&escape(x-1,y,z,visited)|| visited.find(std::to_string(x)+"_"+std::to_string(y+1)+"_"+std::to_string(z))==visited.end()&&escape(x,y+1,z,visited)|| visited.find(std::to_string(x)+"_"+std::to_string(y-1)+"_"+std::to_string(z))==visited.end()&&escape(x,y-1,z,visited)|| visited.find(std::to_string(x)+"_"+std::to_string(y)+"_"+std::to_string(z+1))==visited.end()&&escape(x,y,z+1,visited)|| visited.find(std::to_string(x)+"_"+std::to_string(y)+"_"+std::to_string(z-1))==visited.end()&&escape(x,y,z-1,visited)){ return true; } else { return false; } } } int main() { std::ifstream file("input"); int surfaceArea=0; while (file.good()){ std::string line; std::getline(file,line); if (line.length()>0){ //std::cout<