Created
December 5, 2017 21:38
-
-
Save archer884/115e08aeb5eaaef6a87f9f836d606fc2 to your computer and use it in GitHub Desktop.
AOC/5 (C#)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
namespace AocDay5 | |
{ | |
class Program | |
{ | |
class Resources | |
{ | |
public const string Input = "2\n" | |
+ "0\n" | |
+ "-1\n" | |
+ "0\n" | |
+ "-2\n" | |
+ "-2\n" | |
+ "0\n" | |
+ "-5\n" | |
+ "-6\n" | |
+ "1\n" | |
+ "-4\n" | |
+ "-3\n" | |
+ "1\n" | |
+ "-2\n" | |
+ "-4\n" | |
+ "-9\n" | |
+ "-4\n" | |
+ "-5\n" | |
+ "-10\n" | |
+ "-10\n" | |
+ "-17\n" | |
+ "-8\n" | |
+ "-17\n" | |
+ "-17\n" | |
+ "-10\n" | |
+ "-18\n" | |
+ "-12\n" | |
+ "-21\n" | |
+ "-1\n" | |
+ "-22\n" | |
+ "-4\n" | |
+ "-24\n" | |
+ "-2\n" | |
+ "-16\n" | |
+ "-8\n" | |
+ "-6\n" | |
+ "-33\n" | |
+ "1\n" | |
+ "-2\n" | |
+ "-5\n" | |
+ "-35\n" | |
+ "-20\n" | |
+ "-26\n" | |
+ "-9\n" | |
+ "-15\n" | |
+ "-14\n" | |
+ "-33\n" | |
+ "-24\n" | |
+ "-8\n" | |
+ "2\n" | |
+ "-13\n" | |
+ "-25\n" | |
+ "-45\n" | |
+ "-44\n" | |
+ "-32\n" | |
+ "-50\n" | |
+ "-27\n" | |
+ "-56\n" | |
+ "-56\n" | |
+ "-16\n" | |
+ "-26\n" | |
+ "-8\n" | |
+ "-13\n" | |
+ "-41\n" | |
+ "-48\n" | |
+ "-59\n" | |
+ "-59\n" | |
+ "-34\n" | |
+ "-7\n" | |
+ "-56\n" | |
+ "-8\n" | |
+ "-49\n" | |
+ "-11\n" | |
+ "-16\n" | |
+ "-25\n" | |
+ "-11\n" | |
+ "-4\n" | |
+ "-31\n" | |
+ "-22\n" | |
+ "-12\n" | |
+ "-68\n" | |
+ "-7\n" | |
+ "-13\n" | |
+ "0\n" | |
+ "-12\n" | |
+ "-8\n" | |
+ "-59\n" | |
+ "-73\n" | |
+ "-68\n" | |
+ "-78\n" | |
+ "-46\n" | |
+ "-37\n" | |
+ "-87\n" | |
+ "-63\n" | |
+ "-61\n" | |
+ "-81\n" | |
+ "-83\n" | |
+ "-72\n" | |
+ "-1\n" | |
+ "-36\n" | |
+ "-75\n" | |
+ "-33\n" | |
+ "-31\n" | |
+ "-76\n" | |
+ "-25\n" | |
+ "-15\n" | |
+ "-15\n" | |
+ "-74\n" | |
+ "-74\n" | |
+ "-37\n" | |
+ "-46\n" | |
+ "-82\n" | |
+ "-110\n" | |
+ "-66\n" | |
+ "-60\n" | |
+ "-104\n" | |
+ "-61\n" | |
+ "-55\n" | |
+ "0\n" | |
+ "-109\n" | |
+ "-16\n" | |
+ "-63\n" | |
+ "-118\n" | |
+ "-109\n" | |
+ "-25\n" | |
+ "-96\n" | |
+ "-124\n" | |
+ "-7\n" | |
+ "-20\n" | |
+ "-36\n" | |
+ "-68\n" | |
+ "-38\n" | |
+ "-71\n" | |
+ "-106\n" | |
+ "-7\n" | |
+ "-14\n" | |
+ "-96\n" | |
+ "-117\n" | |
+ "-109\n" | |
+ "-107\n" | |
+ "-112\n" | |
+ "-46\n" | |
+ "-116\n" | |
+ "-128\n" | |
+ "-18\n" | |
+ "-87\n" | |
+ "-20\n" | |
+ "-121\n" | |
+ "-121\n" | |
+ "0\n" | |
+ "-115\n" | |
+ "-89\n" | |
+ "0\n" | |
+ "-12\n" | |
+ "-124\n" | |
+ "-24\n" | |
+ "-18\n" | |
+ "-124\n" | |
+ "-44\n" | |
+ "-99\n" | |
+ "-10\n" | |
+ "-63\n" | |
+ "-103\n" | |
+ "-45\n" | |
+ "-54\n" | |
+ "-99\n" | |
+ "-101\n" | |
+ "-96\n" | |
+ "0\n" | |
+ "-50\n" | |
+ "-143\n" | |
+ "-18\n" | |
+ "-55\n" | |
+ "-78\n" | |
+ "-31\n" | |
+ "-40\n" | |
+ "-62\n" | |
+ "-176\n" | |
+ "-137\n" | |
+ "-5\n" | |
+ "-135\n" | |
+ "-36\n" | |
+ "-52\n" | |
+ "-97\n" | |
+ "-29\n" | |
+ "-16\n" | |
+ "-12\n" | |
+ "-108\n" | |
+ "-64\n" | |
+ "-29\n" | |
+ "-65\n" | |
+ "-128\n" | |
+ "-113\n" | |
+ "-21\n" | |
+ "-135\n" | |
+ "-126\n" | |
+ "-163\n" | |
+ "-51\n" | |
+ "-61\n" | |
+ "-177\n" | |
+ "-52\n" | |
+ "-26\n" | |
+ "-151\n" | |
+ "-142\n" | |
+ "-98\n" | |
+ "-203\n" | |
+ "-178\n" | |
+ "-175\n" | |
+ "-81\n" | |
+ "-110\n" | |
+ "-201\n" | |
+ "-150\n" | |
+ "-104\n" | |
+ "-117\n" | |
+ "-165\n" | |
+ "-4\n" | |
+ "-96\n" | |
+ "-9\n" | |
+ "-118\n" | |
+ "-123\n" | |
+ "-156\n" | |
+ "-39\n" | |
+ "-122\n" | |
+ "-59\n" | |
+ "-223\n" | |
+ "-9\n" | |
+ "-14\n" | |
+ "-53\n" | |
+ "-191\n" | |
+ "-23\n" | |
+ "-171\n" | |
+ "-7\n" | |
+ "-131\n" | |
+ "-2\n" | |
+ "-225\n" | |
+ "-20\n" | |
+ "-66\n" | |
+ "-225\n" | |
+ "-203\n" | |
+ "-41\n" | |
+ "-122\n" | |
+ "-159\n" | |
+ "-222\n" | |
+ "-96\n" | |
+ "-134\n" | |
+ "-191\n" | |
+ "-105\n" | |
+ "-78\n" | |
+ "-139\n" | |
+ "-225\n" | |
+ "-164\n" | |
+ "-109\n" | |
+ "-178\n" | |
+ "-186\n" | |
+ "-24\n" | |
+ "-161\n" | |
+ "-125\n" | |
+ "-214\n" | |
+ "-199\n" | |
+ "-152\n" | |
+ "-172\n" | |
+ "-102\n" | |
+ "-217\n" | |
+ "-15\n" | |
+ "-60\n" | |
+ "-148\n" | |
+ "-173\n" | |
+ "-10\n" | |
+ "-258\n" | |
+ "-119\n" | |
+ "-9\n" | |
+ "-11\n" | |
+ "-6\n" | |
+ "-53\n" | |
+ "-220\n" | |
+ "-57\n" | |
+ "-123\n" | |
+ "-62\n" | |
+ "-172\n" | |
+ "-80\n" | |
+ "-200\n" | |
+ "-236\n" | |
+ "-255\n" | |
+ "-61\n" | |
+ "-199\n" | |
+ "-165\n" | |
+ "-277\n" | |
+ "-32\n" | |
+ "-169\n" | |
+ "-108\n" | |
+ "-86\n" | |
+ "-137\n" | |
+ "2\n" | |
+ "-96\n" | |
+ "-204\n" | |
+ "-269\n" | |
+ "-181\n" | |
+ "-96\n" | |
+ "-166\n" | |
+ "-271\n" | |
+ "-235\n" | |
+ "-75\n" | |
+ "-245\n" | |
+ "-6\n" | |
+ "-95\n" | |
+ "-130\n" | |
+ "-303\n" | |
+ "-55\n" | |
+ "-227\n" | |
+ "-266\n" | |
+ "-82\n" | |
+ "-298\n" | |
+ "-135\n" | |
+ "-272\n" | |
+ "-311\n" | |
+ "-311\n" | |
+ "-86\n" | |
+ "-198\n" | |
+ "-41\n" | |
+ "-147\n" | |
+ "-169\n" | |
+ "-91\n" | |
+ "-65\n" | |
+ "-122\n" | |
+ "-293\n" | |
+ "-149\n" | |
+ "-218\n" | |
+ "-325\n" | |
+ "-292\n" | |
+ "-136\n" | |
+ "-119\n" | |
+ "-100\n" | |
+ "-290\n" | |
+ "-48\n" | |
+ "-257\n" | |
+ "-282\n" | |
+ "-199\n" | |
+ "-67\n" | |
+ "-262\n" | |
+ "-75\n" | |
+ "-274\n" | |
+ "-136\n" | |
+ "-87\n" | |
+ "-123\n" | |
+ "-61\n" | |
+ "-258\n" | |
+ "-117\n" | |
+ "-93\n" | |
+ "-113\n" | |
+ "-250\n" | |
+ "-225\n" | |
+ "-250\n" | |
+ "-135\n" | |
+ "-342\n" | |
+ "-304\n" | |
+ "-153\n" | |
+ "-114\n" | |
+ "-335\n" | |
+ "-327\n" | |
+ "-276\n" | |
+ "-119\n" | |
+ "-35\n" | |
+ "-75\n" | |
+ "-239\n" | |
+ "-140\n" | |
+ "-199\n" | |
+ "-354\n" | |
+ "-94\n" | |
+ "-51\n" | |
+ "-176\n" | |
+ "-35\n" | |
+ "-121\n" | |
+ "2\n" | |
+ "-51\n" | |
+ "-80\n" | |
+ "-116\n" | |
+ "-69\n" | |
+ "-282\n" | |
+ "-180\n" | |
+ "-10\n" | |
+ "-103\n" | |
+ "-172\n" | |
+ "-332\n" | |
+ "-158\n" | |
+ "-95\n" | |
+ "-365\n" | |
+ "-358\n" | |
+ "-69\n" | |
+ "-263\n" | |
+ "-75\n" | |
+ "-74\n" | |
+ "-1\n" | |
+ "-236\n" | |
+ "-28\n" | |
+ "-311\n" | |
+ "-364\n" | |
+ "-275\n" | |
+ "-333\n" | |
+ "-52\n" | |
+ "-376\n" | |
+ "-156\n" | |
+ "-310\n" | |
+ "-276\n" | |
+ "-160\n" | |
+ "-218\n" | |
+ "-341\n" | |
+ "-78\n" | |
+ "-184\n" | |
+ "-14\n" | |
+ "-291\n" | |
+ "-279\n" | |
+ "-248\n" | |
+ "0\n" | |
+ "-199\n" | |
+ "-252\n" | |
+ "-221\n" | |
+ "-23\n" | |
+ "-371\n" | |
+ "-39\n" | |
+ "-355\n" | |
+ "0\n" | |
+ "-211\n" | |
+ "-151\n" | |
+ "-34\n" | |
+ "-209\n" | |
+ "-310\n" | |
+ "-215\n" | |
+ "-76\n" | |
+ "-398\n" | |
+ "-21\n" | |
+ "-206\n" | |
+ "-339\n" | |
+ "-147\n" | |
+ "-47\n" | |
+ "-70\n" | |
+ "-105\n" | |
+ "-340\n" | |
+ "-128\n" | |
+ "-321\n" | |
+ "-101\n" | |
+ "-225\n" | |
+ "-425\n" | |
+ "-248\n" | |
+ "-117\n" | |
+ "-437\n" | |
+ "-379\n" | |
+ "-196\n" | |
+ "-262\n" | |
+ "-236\n" | |
+ "-365\n" | |
+ "-217\n" | |
+ "-213\n" | |
+ "-70\n" | |
+ "-406\n" | |
+ "-414\n" | |
+ "-425\n" | |
+ "-332\n" | |
+ "-13\n" | |
+ "-120\n" | |
+ "-238\n" | |
+ "-238\n" | |
+ "-110\n" | |
+ "-224\n" | |
+ "-116\n" | |
+ "-414\n" | |
+ "-419\n" | |
+ "-309\n" | |
+ "-121\n" | |
+ "-104\n" | |
+ "-9\n" | |
+ "-406\n" | |
+ "-82\n" | |
+ "-72\n" | |
+ "-249\n" | |
+ "-432\n" | |
+ "-380\n" | |
+ "-14\n" | |
+ "-388\n" | |
+ "-403\n" | |
+ "-249\n" | |
+ "-349\n" | |
+ "-480\n" | |
+ "-118\n" | |
+ "-243\n" | |
+ "-285\n" | |
+ "1\n" | |
+ "-126\n" | |
+ "-33\n" | |
+ "-99\n" | |
+ "-241\n" | |
+ "-151\n" | |
+ "-329\n" | |
+ "-64\n" | |
+ "-63\n" | |
+ "-120\n" | |
+ "-75\n" | |
+ "-255\n" | |
+ "-118\n" | |
+ "-177\n" | |
+ "-138\n" | |
+ "-451\n" | |
+ "-306\n" | |
+ "-245\n" | |
+ "-33\n" | |
+ "-55\n" | |
+ "-90\n" | |
+ "-212\n" | |
+ "-301\n" | |
+ "-168\n" | |
+ "-363\n" | |
+ "-314\n" | |
+ "-417\n" | |
+ "-385\n" | |
+ "-52\n" | |
+ "-497\n" | |
+ "-131\n" | |
+ "-71\n" | |
+ "-134\n" | |
+ "-69\n" | |
+ "-138\n" | |
+ "-141\n" | |
+ "-347\n" | |
+ "-358\n" | |
+ "-505\n" | |
+ "-294\n" | |
+ "-288\n" | |
+ "-432\n" | |
+ "-234\n" | |
+ "-439\n" | |
+ "-112\n" | |
+ "-260\n" | |
+ "-31\n" | |
+ "-273\n" | |
+ "-86\n" | |
+ "-362\n" | |
+ "-237\n" | |
+ "-369\n" | |
+ "-442\n" | |
+ "-402\n" | |
+ "-453\n" | |
+ "-30\n" | |
+ "-171\n" | |
+ "-33\n" | |
+ "-170\n" | |
+ "-20\n" | |
+ "-539\n" | |
+ "-93\n" | |
+ "-456\n" | |
+ "-240\n" | |
+ "-10\n" | |
+ "-344\n" | |
+ "-150\n" | |
+ "-262\n" | |
+ "-417\n" | |
+ "-421\n" | |
+ "-44\n" | |
+ "-15\n" | |
+ "-51\n" | |
+ "-69\n" | |
+ "-268\n" | |
+ "-290\n" | |
+ "-344\n" | |
+ "-196\n" | |
+ "-556\n" | |
+ "-519\n" | |
+ "-242\n" | |
+ "-197\n" | |
+ "-546\n" | |
+ "-99\n" | |
+ "-377\n" | |
+ "-225\n" | |
+ "-113\n" | |
+ "-138\n" | |
+ "-120\n" | |
+ "-263\n" | |
+ "-170\n" | |
+ "-452\n" | |
+ "-405\n" | |
+ "-376\n" | |
+ "-551\n" | |
+ "-190\n" | |
+ "-9\n" | |
+ "-224\n" | |
+ "-110\n" | |
+ "-183\n" | |
+ "-454\n" | |
+ "-212\n" | |
+ "-55\n" | |
+ "-264\n" | |
+ "-348\n" | |
+ "-510\n" | |
+ "-152\n" | |
+ "-71\n" | |
+ "-356\n" | |
+ "-424\n" | |
+ "-233\n" | |
+ "-234\n" | |
+ "-10\n" | |
+ "-524\n" | |
+ "-76\n" | |
+ "-251\n" | |
+ "-456\n" | |
+ "-578\n" | |
+ "-348\n" | |
+ "-176\n" | |
+ "-406\n" | |
+ "-173\n" | |
+ "-160\n" | |
+ "-603\n" | |
+ "-129\n" | |
+ "-558\n" | |
+ "-106\n" | |
+ "-535\n" | |
+ "-465\n" | |
+ "-310\n" | |
+ "-569\n" | |
+ "-302\n" | |
+ "-504\n" | |
+ "0\n" | |
+ "-175\n" | |
+ "-59\n" | |
+ "-485\n" | |
+ "-586\n" | |
+ "-88\n" | |
+ "-136\n" | |
+ "-524\n" | |
+ "-164\n" | |
+ "-55\n" | |
+ "-150\n" | |
+ "-191\n" | |
+ "-40\n" | |
+ "-552\n" | |
+ "-386\n" | |
+ "-217\n" | |
+ "-119\n" | |
+ "-250\n" | |
+ "-448\n" | |
+ "-357\n" | |
+ "-485\n" | |
+ "-623\n" | |
+ "-412\n" | |
+ "-202\n" | |
+ "-266\n" | |
+ "-55\n" | |
+ "-256\n" | |
+ "-169\n" | |
+ "-327\n" | |
+ "-165\n" | |
+ "-101\n" | |
+ "-550\n" | |
+ "-434\n" | |
+ "-176\n" | |
+ "-152\n" | |
+ "-518\n" | |
+ "-624\n" | |
+ "-374\n" | |
+ "-305\n" | |
+ "-370\n" | |
+ "-304\n" | |
+ "-362\n" | |
+ "-109\n" | |
+ "-277\n" | |
+ "-53\n" | |
+ "-318\n" | |
+ "-574\n" | |
+ "-338\n" | |
+ "-276\n" | |
+ "-620\n" | |
+ "-306\n" | |
+ "-499\n" | |
+ "-77\n" | |
+ "-122\n" | |
+ "-329\n" | |
+ "-156\n" | |
+ "-654\n" | |
+ "-576\n" | |
+ "-79\n" | |
+ "-498\n" | |
+ "-9\n" | |
+ "-15\n" | |
+ "-445\n" | |
+ "-415\n" | |
+ "-491\n" | |
+ "-641\n" | |
+ "-104\n" | |
+ "-600\n" | |
+ "-126\n" | |
+ "-156\n" | |
+ "0\n" | |
+ "-70\n" | |
+ "-271\n" | |
+ "-162\n" | |
+ "0\n" | |
+ "-640\n" | |
+ "-505\n" | |
+ "-261\n" | |
+ "0\n" | |
+ "-476\n" | |
+ "-555\n" | |
+ "-130\n" | |
+ "-423\n" | |
+ "-360\n" | |
+ "-138\n" | |
+ "-457\n" | |
+ "-674\n" | |
+ "-303\n" | |
+ "-624\n" | |
+ "-513\n" | |
+ "-566\n" | |
+ "-405\n" | |
+ "-406\n" | |
+ "-632\n" | |
+ "-177\n" | |
+ "-66\n" | |
+ "-277\n" | |
+ "-445\n" | |
+ "-117\n" | |
+ "-628\n" | |
+ "-452\n" | |
+ "-156\n" | |
+ "-535\n" | |
+ "-254\n" | |
+ "-44\n" | |
+ "-466\n" | |
+ "-142\n" | |
+ "-414\n" | |
+ "-473\n" | |
+ "-201\n" | |
+ "-85\n" | |
+ "-336\n" | |
+ "-660\n" | |
+ "-607\n" | |
+ "-376\n" | |
+ "-367\n" | |
+ "-582\n" | |
+ "-619\n" | |
+ "-499\n" | |
+ "-89\n" | |
+ "-232\n" | |
+ "-708\n" | |
+ "-731\n" | |
+ "-215\n" | |
+ "-72\n" | |
+ "-159\n" | |
+ "-278\n" | |
+ "-53\n" | |
+ "-257\n" | |
+ "-104\n" | |
+ "-7\n" | |
+ "-745\n" | |
+ "-403\n" | |
+ "-534\n" | |
+ "-17\n" | |
+ "-520\n" | |
+ "-510\n" | |
+ "-353\n" | |
+ "-504\n" | |
+ "-578\n" | |
+ "-729\n" | |
+ "-139\n" | |
+ "-271\n" | |
+ "-181\n" | |
+ "-134\n" | |
+ "-475\n" | |
+ "-251\n" | |
+ "-490\n" | |
+ "-205\n" | |
+ "-675\n" | |
+ "-112\n" | |
+ "-753\n" | |
+ "-256\n" | |
+ "-485\n" | |
+ "-234\n" | |
+ "-654\n" | |
+ "-403\n" | |
+ "-450\n" | |
+ "-658\n" | |
+ "-172\n" | |
+ "-675\n" | |
+ "-54\n" | |
+ "-169\n" | |
+ "-230\n" | |
+ "-1\n" | |
+ "-436\n" | |
+ "-108\n" | |
+ "-660\n" | |
+ "-289\n" | |
+ "-367\n" | |
+ "-314\n" | |
+ "-68\n" | |
+ "-572\n" | |
+ "-586\n" | |
+ "-369\n" | |
+ "-145\n" | |
+ "-543\n" | |
+ "-756\n" | |
+ "-78\n" | |
+ "-490\n" | |
+ "-785\n" | |
+ "-180\n" | |
+ "2\n" | |
+ "-424\n" | |
+ "-159\n" | |
+ "-727\n" | |
+ "-235\n" | |
+ "-645\n" | |
+ "-28\n" | |
+ "-282\n" | |
+ "-489\n" | |
+ "-250\n" | |
+ "-71\n" | |
+ "-682\n" | |
+ "-711\n" | |
+ "-398\n" | |
+ "-55\n" | |
+ "-328\n" | |
+ "-182\n" | |
+ "-166\n" | |
+ "-743\n" | |
+ "-388\n" | |
+ "-334\n" | |
+ "-432\n" | |
+ "-729\n" | |
+ "-360\n" | |
+ "-471\n" | |
+ "-16\n" | |
+ "-602\n" | |
+ "-709\n" | |
+ "-69\n" | |
+ "-269\n" | |
+ "-791\n" | |
+ "-489\n" | |
+ "-322\n" | |
+ "-646\n" | |
+ "-301\n" | |
+ "-159\n" | |
+ "-268\n" | |
+ "-777\n" | |
+ "-456\n" | |
+ "-746\n" | |
+ "-356\n" | |
+ "-809\n" | |
+ "-728\n" | |
+ "-90\n" | |
+ "-302\n" | |
+ "-386\n" | |
+ "-728\n" | |
+ "-656\n" | |
+ "-29\n" | |
+ "-101\n" | |
+ "-728\n" | |
+ "-82\n" | |
+ "-406\n" | |
+ "-675\n" | |
+ "-62\n" | |
+ "-160\n" | |
+ "-617\n" | |
+ "-125\n" | |
+ "-698\n" | |
+ "-120\n" | |
+ "-655\n" | |
+ "-751\n" | |
+ "-284\n" | |
+ "-475\n" | |
+ "-16\n" | |
+ "-420\n" | |
+ "-574\n" | |
+ "-638\n" | |
+ "-38\n" | |
+ "-573\n" | |
+ "-623\n" | |
+ "-747\n" | |
+ "-115\n" | |
+ "-430\n" | |
+ "-591\n" | |
+ "-832\n" | |
+ "-422\n" | |
+ "-40\n" | |
+ "-212\n" | |
+ "-564\n" | |
+ "-71\n" | |
+ "-513\n" | |
+ "-623\n" | |
+ "-503\n" | |
+ "-189\n" | |
+ "-256\n" | |
+ "-728\n" | |
+ "-655\n" | |
+ "-580\n" | |
+ "-508\n" | |
+ "-382\n" | |
+ "-883\n" | |
+ "-885\n" | |
+ "-480\n" | |
+ "-117\n" | |
+ "-407\n" | |
+ "-253\n" | |
+ "-635\n" | |
+ "-244\n" | |
+ "-101\n" | |
+ "-847\n" | |
+ "-857\n" | |
+ "-205\n" | |
+ "-119\n" | |
+ "-756\n" | |
+ "-302\n" | |
+ "-169\n" | |
+ "-277\n" | |
+ "-521\n" | |
+ "-586\n" | |
+ "-472\n" | |
+ "-880\n" | |
+ "-580\n" | |
+ "-825\n" | |
+ "-428\n" | |
+ "-248\n" | |
+ "-846\n" | |
+ "-226\n" | |
+ "-621\n" | |
+ "-413\n" | |
+ "-302\n" | |
+ "-161\n" | |
+ "-177\n" | |
+ "-601\n" | |
+ "-830\n" | |
+ "-275\n" | |
+ "-700\n" | |
+ "-922\n" | |
+ "0\n" | |
+ "-897\n" | |
+ "-764\n" | |
+ "-151\n" | |
+ "-343\n" | |
+ "-10\n" | |
+ "-601\n" | |
+ "-772\n" | |
+ "-574\n" | |
+ "-478\n" | |
+ "-791\n" | |
+ "-244\n" | |
+ "-4\n" | |
+ "-927\n" | |
+ "-601\n" | |
+ "-686\n" | |
+ "-109\n" | |
+ "-786\n" | |
+ "-224\n" | |
+ "-409\n" | |
+ "-725\n" | |
+ "-411\n" | |
+ "-692\n" | |
+ "-886\n" | |
+ "-667\n" | |
+ "-767\n" | |
+ "-773\n" | |
+ "-623\n" | |
+ "-868\n" | |
+ "-319\n" | |
+ "-739\n" | |
+ "-36\n" | |
+ "-309\n" | |
+ "-634\n" | |
+ "-240\n" | |
+ "-790\n" | |
+ "-711\n" | |
+ "-426\n" | |
+ "-426\n" | |
+ "-860\n" | |
+ "-227\n" | |
+ "-677\n" | |
+ "-67\n" | |
+ "-567\n" | |
+ "-621\n" | |
+ "-714\n" | |
+ "-430\n" | |
+ "-914\n" | |
+ "-335\n" | |
+ "-601\n" | |
+ "-205\n" | |
+ "-475\n" | |
+ "-737\n" | |
+ "-60\n" | |
+ "-28\n" | |
+ "-19\n" | |
+ "-221\n" | |
+ "-660\n" | |
+ "-386\n" | |
+ "-67\n" | |
+ "-474\n" | |
+ "-49\n" | |
+ "-488\n" | |
+ "-207\n" | |
+ "-209\n" | |
+ "-178\n" | |
+ "-889\n" | |
+ "-370\n" | |
+ "-180\n" | |
+ "-232\n" | |
+ "-709\n" | |
+ "-861\n" | |
+ "-359\n" | |
+ "-372\n" | |
+ "-591\n" | |
+ "-80\n" | |
+ "-709\n" | |
+ "-340\n" | |
+ "-441\n" | |
+ "-116\n" | |
+ "-156\n" | |
+ "-525\n" | |
+ "-687\n" | |
+ "-604\n" | |
+ "-31\n" | |
+ "-303\n" | |
+ "-425\n" | |
+ "-650\n" | |
+ "-642\n" | |
+ "-606\n" | |
+ "-626\n" | |
+ "-332\n" | |
+ "-26\n" | |
+ "-126\n" | |
+ "-846\n" | |
+ "-672\n" | |
+ "-74\n" | |
+ "-201\n" | |
+ "-256\n" | |
+ "-660\n" | |
+ "-342\n" | |
+ "-184\n" | |
+ "-1008\n" | |
+ "-196\n" | |
+ "-757\n" | |
+ "-522\n" | |
+ "-293\n" | |
+ "-241\n" | |
+ "-662\n" | |
+ "-655\n" | |
+ "-617\n" | |
+ "-810\n" | |
+ "-943\n" | |
+ "-295\n" | |
+ "-506\n" | |
+ "-904\n" | |
+ "-1038\n" | |
+ "-966\n" | |
+ "-259\n" | |
+ "-1025\n" | |
+ "-448\n" | |
+ "-597\n" | |
+ "-210\n" | |
+ "-45\n" | |
+ "-533\n" | |
+ "-48\n" | |
+ "-943\n" | |
+ "-618\n" | |
+ "1\n" | |
+ "-697\n" | |
+ "-1049\n" | |
+ "-607\n" | |
+ "-668\n" | |
+ "-164\n" | |
+ "-751\n" | |
+ "-722\n" | |
+ "-940\n" | |
+ "-381\n" | |
+ "-194\n" | |
+ "-671\n" | |
+ "-336\n" | |
+ "-738\n" | |
+ "-712\n" | |
+ "-390\n" | |
+ "-352\n" | |
+ "-35\n" | |
+ "-470\n" | |
+ "-737\n" | |
+ "-715\n" | |
+ "-663\n" | |
+ "-549\n" | |
+ "-598\n" | |
+ "-707\n" | |
+ "-135\n" | |
+ "-277\n" | |
+ "-470\n" | |
+ "-225\n" | |
+ "-742\n" | |
+ "-1010\n" | |
+ "-10\n" | |
+ "-134\n" | |
+ "0\n" | |
+ "-724\n" | |
+ "-811\n" | |
+ "-758\n" | |
+ "-869\n" | |
+ "-1029\n" | |
+ "-567\n" | |
+ "-889"; | |
} | |
static void Main(string[] args) | |
{ | |
var instructions = Resources.Input.Split('\n') | |
.Select(int.Parse) | |
.ToList(); | |
var time = Stopwatch.StartNew(); | |
Console.WriteLine(RunProgram(instructions, Offset)); | |
time.Stop(); | |
Console.WriteLine(time.ElapsedMilliseconds); | |
} | |
static int Offset(int n) | |
{ | |
return n >= 3 ? n - 1 : n + 1; | |
} | |
static int RunProgram(IList<int> instructions, Func<int, int> offset) | |
{ | |
var pointer = 0; | |
var counter = 0; | |
while (pointer >= 0 && pointer < instructions.Count) | |
{ | |
var nextPointer = pointer + instructions[pointer]; | |
instructions[pointer] = offset(instructions[pointer]); | |
pointer = nextPointer; | |
++counter; | |
} | |
return counter; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment