diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..009e4f9 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "files.associations": { + "iostream": "cpp", + "*.tcc": "cpp" + } +} \ No newline at end of file diff --git a/2/input.txt b/2/input.txt index b45580b..b5fb48c 100644 --- a/2/input.txt +++ b/2/input.txt @@ -1,3 +1,6 @@ +86 87 88 90 92 93 93 90 +3 5 8 8 10 14 +20 23 25 25 25 81 83 84 85 87 87 90 92 95 96 93 12 15 16 17 17 @@ -9,9 +12,6 @@ 60 63 65 63 65 69 70 73 76 79 77 78 84 25 27 29 32 35 35 36 -86 87 88 90 92 93 93 90 -20 23 25 25 25 -3 5 8 8 10 14 3 4 7 9 12 12 14 20 72 75 79 80 82 5 7 11 14 15 18 15 diff --git a/2/puzzle2p2.cpp b/2/puzzle2p2.cpp index 390c63c..68e3208 100644 --- a/2/puzzle2p2.cpp +++ b/2/puzzle2p2.cpp @@ -19,6 +19,7 @@ int main(){ string line; int safeReports = 0; stringstream wholeDoc; + int linesReadFromFile= 0; ifstream puzzle("input.txt", ifstream::in); @@ -30,6 +31,7 @@ int main(){ int number = stoi(numberString); currentLevels.push_back(number); } + linesReadFromFile++; list currentLevelsBackup = currentLevels; int numOfLevelsProcessed = 0; @@ -91,6 +93,12 @@ int main(){ listDirty = true; } + if(listDirty&&dir==DOWN&&levelGoesUp.size()>0){ + currentLevels.clear(); + } else if(listDirty&&dir==UP&&levelGoDown.size()>0){ + currentLevels.clear(); + } + if (!currentLevels.empty()){ if (dir==UP&&levelGoDown.size()==1){ list::iterator itNumberToDelete = currentLevels.begin(); @@ -125,6 +133,7 @@ int main(){ } } -cout << safeReports; +cout <<"lines read in: " << linesReadFromFile<<"\n"; +cout <<"safe Reports: " << safeReports; puzzle.close(); } \ No newline at end of file diff --git a/2/puzzle2p2.exe b/2/puzzle2p2.exe index aa699ec..0ade387 100644 Binary files a/2/puzzle2p2.exe and b/2/puzzle2p2.exe differ diff --git a/2/puzzle2p2.ilk b/2/puzzle2p2.ilk index e69cb09..19a13ac 100644 Binary files a/2/puzzle2p2.ilk and b/2/puzzle2p2.ilk differ diff --git a/2/puzzle2p2.obj b/2/puzzle2p2.obj index f19b79b..925fb65 100644 Binary files a/2/puzzle2p2.obj and b/2/puzzle2p2.obj differ diff --git a/2/puzzle2p2.pdb b/2/puzzle2p2.pdb index 5b20e4e..5609a63 100644 Binary files a/2/puzzle2p2.pdb and b/2/puzzle2p2.pdb differ diff --git a/2/vc140.pdb b/2/vc140.pdb index ffe014e..ef02d81 100644 Binary files a/2/vc140.pdb and b/2/vc140.pdb differ