restructured for part 2
This commit is contained in:
parent
f435e9b5a6
commit
e778c916b6
|
@ -73,14 +73,14 @@ you found. In the example above, this is 2 + 1 + 0 + 1 + 2 + 5, a total distance
|
||||||
Your actual left and right lists contain many location IDs. What is the total distance between your lists?
|
Your actual left and right lists contain many location IDs. What is the total distance between your lists?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void day01::Run()
|
void day01::Part1()
|
||||||
{
|
{
|
||||||
std::vector<int> col1;
|
std::vector<int> col1;
|
||||||
std::vector<int> col2;
|
std::vector<int> col2;
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
|
|
||||||
std::ifstream input("input/day01.txt");
|
// std::ifstream input("input/day01.txt");
|
||||||
//std::ifstream input("input/day01short.txt");
|
std::ifstream input("input/day01short.txt");
|
||||||
|
|
||||||
if (!input)
|
if (!input)
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
class day01
|
class day01
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Run();
|
static void Part1();
|
||||||
|
static void Part2();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
2
main.cpp
2
main.cpp
|
@ -6,7 +6,7 @@
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
const auto startTime = std::chrono::high_resolution_clock::now();
|
const auto startTime = std::chrono::high_resolution_clock::now();
|
||||||
day01::Run();
|
day01::Part2();
|
||||||
const auto endTime = std::chrono::high_resolution_clock::now();
|
const auto endTime = std::chrono::high_resolution_clock::now();
|
||||||
const std::chrono::duration<double> diff = endTime - startTime;
|
const std::chrono::duration<double> diff = endTime - startTime;
|
||||||
std::cout << "Execution time: " << diff.count() * 1e6 << " μs" << std::endl;
|
std::cout << "Execution time: " << diff.count() * 1e6 << " μs" << std::endl;
|
||||||
|
|
Loading…
Reference in New Issue