#define OLC_PGE_APPLICATION #include "pixelGameEngine.h" #include "olcutils.h" #include "List.h" #include enum status{ FALSE, TRUE, CONTINUE }; status examineList(List*list1,List*list2){ std::cout<<"Examining "<<*list1<<" vs "<<*list2<index>=list2->elements.size()&&list1->elements.size()>list1->index){ return FALSE; } if (list1->index>=list1->elements.size()){ if (list2->index>=list2->elements.size()){ return CONTINUE; } return TRUE; } Element e1=list1->elements[list1->index]; Element e2=list2->elements[list2->index]; if (e1.list==nullptr&&e2.list==nullptr){ if (e1.numbere2.number){ return FALSE; } } else if (e1.list!=nullptr&&e2.list!=nullptr){ status Result = examineList(e1.list,e2.list); if (Result!=CONTINUE){ return Result; } } else { if (e1.list==nullptr){ e1.list = new List(); Element newE; newE.number=e1.number; e1.list->elements.push_back(newE); status Result = examineList(e1.list,e2.list); if (Result!=CONTINUE){ return Result; } } else { e2.list = new List(); Element newE; newE.number=e2.number; e2.list->elements.push_back(newE); status Result = examineList(e1.list,e2.list); if (Result!=CONTINUE){ return Result; } } } list1->index++; list2->index++; } return TRUE; //Inputs are in the right order. } using namespace olc; int main() { int sum=0; std::ifstream file("input"); int index=1; while (file.good()){ std::string line; List*list1; List*list2; for (int j=0;j<2;j++){ std::getline(file,line); List*startingList=new List(); List*currentList=nullptr; for (int i=0;iparent=currentList; currentList->elements.push_back(el); currentList=el.list; } } else if (line[i]==']'){ //std::cout<<"Read "<parent; } else if (line[i]==','){ //std::cout<<"Read "<='0'&&line[i]<='9'){ //std::cout<<"Read "<elements.push_back(el); i--; } } if (j==0){ list1=startingList; } else { list2=startingList; } } std::getline(file,line); std::cout<<"List 1: "<<*list1<