#define OLC_PGE_APPLICATION #include "pixelGameEngine.h" #include "olcutils.h" using namespace olc; struct Sensor{ vi2d pos; int radius; }; int main() { std::ifstream file("input"); std::vectorsensors; while (file.good()){ std::string line; std::getline(file,line); std::cout<0){ while (prevMarker!=std::string::npos){ std::string word=line.substr(prevMarker,marker-prevMarker); prevMarker=marker; marker=line.find(' ',prevMarker+1); if (word[1]=='x'){ if (sensorPos.x==-999){ sensorPos.x=std::atoi(word.substr(word.find('=')+1,word.find(',')-word.find('=')-1).c_str()); std::cout<<"Sensor X: "< Beacon Radius: "<>ranges; for (Sensor s:sensors){ int distance=std::abs(s.pos.y-targetY); if (distance=maxX){ maxX=minX-1; break; } if (ranges[i].first>minX&&ranges[i].second Removed Range "<=maxX){ maxX=ranges[i].first-1; } if (ranges[i].first<=minX&&ranges[i].second>=minX){ minX=ranges[i].second+1; } } if (maxX>=minX){ std::cout<<" --> Range is truncated to "<