|
@@ -75,14 +75,19 @@ type Car struct {
|
75
|
75
|
Arrival int
|
76
|
76
|
X int
|
77
|
77
|
Y int
|
|
78
|
+
|
|
79
|
+ score int
|
78
|
80
|
}
|
79
|
81
|
|
80
|
82
|
func (c *Car) Update(r *Ride) {
|
81
|
83
|
c.moveTo(r.a, r.b)
|
82
|
|
- if c.Arrival < r.s {
|
|
84
|
+ if c.Arrival <= r.s {
|
83
|
85
|
c.Arrival = r.s
|
|
86
|
+ // count bonus points for being on time
|
|
87
|
+ c.score += B
|
84
|
88
|
}
|
85
|
89
|
c.moveTo(r.x, r.y)
|
|
90
|
+ c.score += r.length()
|
86
|
91
|
c.Rides = append(c.Rides, r.ID)
|
87
|
92
|
}
|
88
|
93
|
|
|
@@ -194,13 +199,16 @@ func solve() {
|
194
|
199
|
for assign() {
|
195
|
200
|
}
|
196
|
201
|
|
|
202
|
+ totalScore := 0
|
197
|
203
|
for _, c := range Cars {
|
198
|
204
|
fmt.Fprintf(output, "%d", len(c.Rides))
|
199
|
205
|
for _, ri := range c.Rides {
|
200
|
206
|
fmt.Fprintf(output, " %d", ri)
|
201
|
207
|
}
|
202
|
208
|
fmt.Fprintf(output, "\n")
|
|
209
|
+ totalScore += c.score
|
203
|
210
|
}
|
|
211
|
+ fmt.Printf("%d\n", totalScore)
|
204
|
212
|
}
|
205
|
213
|
|
206
|
214
|
func main() {
|