#define OLC_PGE_HEADLESS #define OLC_PGE_APPLICATION #include "pixelGameEngine.h" using namespace olc; struct Data{ long value; //Number. int position; //Current position in the list. }; int main() { std::ifstream file("input"); std::vectororiginalSet; std::vectornewSet; while (file.good()){ std::string line; std::getline(file,line); //std::cout<0){ Data*data=new Data{std::atoi(line.c_str())*811589153l,(int)originalSet.size()}; originalSet.push_back(data); newSet.push_back(data); } } std::cout<value<<" ["<position<<"]"; } std::cout<position; Data*temp=newSet[pos]; long shift=(val->value)%(long)(originalSet.size()-1l); std::cout<<"Shift value is "<0){ //Move it to the right of the list. int newPos=(pos+1)%newSet.size(); /*std::cout<<" Swap "<value<<" ["<position<<"]"; std::cout<<" with "<value<<" ["<position<<"]"<position=newPos; newSet[pos]->position=pos; shift--; pos=newPos; } else { //Move it to the left of the list. int newPos=pos-1; if (newPos<0){ newPos=newSet.size()-1; } /*std::cout<<" Swap "<value<<" ["<position<<"]"; std::cout<<" with "<value<<" ["<position<<"]";*/ newSet[pos]=newSet[newPos]; newSet[newPos]=temp; newSet[newPos]->position=newPos; newSet[pos]->position=pos; shift++; pos=newPos; } } /*std::cout<value<<" ["<position<<"]"; } std::cout<value<<" ["<position<<"]"; } std::cout<value==0){ zeroVal=newSet[i]; break; } } int offset=(zeroVal->position+1000)%newSet.size(); int offset2=(zeroVal->position+2000)%newSet.size(); int offset3=(zeroVal->position+3000)%newSet.size(); std::cout<<"1000: "<value<value<value<value+newSet[offset2]->value+newSet[offset3]->value; std::cout<<"Sum: "<