-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
74 lines (56 loc) · 1.08 KB
/
Copy pathmain.go
File metadata and controls
74 lines (56 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package main
import (
"flag"
"fmt"
"io"
"log"
"os"
"strings"
"time"
. "github.com/agimenez/adventofcode/utils"
)
var (
debug bool
)
func dbg(f string, v ...interface{}) {
if debug {
fmt.Printf(f+"\n", v...)
}
}
func init() {
flag.BoolVar(&debug, "debug", false, "enable debug")
}
func main() {
flag.Parse()
p, err := io.ReadAll(os.Stdin)
if err != nil {
panic("could not read input")
}
lines := strings.Split(string(p), "\n")
lines = lines[:len(lines)-1]
//dbg("lines: %#v", lines)
part1, part2, dur1, dur2 := solve(lines)
log.Printf("Part 1 (%v): %v\n", dur1, part1)
log.Printf("Part 2 (%v): %v\n", dur2, part2)
}
func solve(lines []string) (int, int, time.Duration, time.Duration) {
var now time.Time
var dur [2]time.Duration
now = time.Now()
part1 := solve1(lines)
dur[0] = time.Since(now)
now = time.Now()
part2 := solve2(lines)
dur[1] = time.Since(now)
return part1, part2, dur[0], dur[1]
}
func solve1(s []string) int {
res := 0
dbg("")
return res
}
func solve2(s []string) int {
res := 0
dbg("========== PART 2 ===========")
return res
}