Merge branch 'master' of github.com:GeoffreyFrogeye/hashcode2016
This commit is contained in:
commit
3fc03d19c2
3
main.py
3
main.py
|
@ -141,6 +141,7 @@ def load(d, w, p, q):
|
||||||
assert(weight(d) <= M)
|
assert(weight(d) <= M)
|
||||||
assert(Dd[d] <= T)
|
assert(Dd[d] <= T)
|
||||||
print("Drone", d, "loads", q, "of", p, "from warehouse", w, "→", Dd[d])
|
print("Drone", d, "loads", q, "of", p, "from warehouse", w, "→", Dd[d])
|
||||||
|
Out.append(str(d) + ' L ' + str(w) + ' ' + str(p) + ' ' + str(q))
|
||||||
|
|
||||||
def unload(d, w, p, q):
|
def unload(d, w, p, q):
|
||||||
# drone number, warehouse, product, qt
|
# drone number, warehouse, product, qt
|
||||||
|
@ -151,6 +152,7 @@ def unload(d, w, p, q):
|
||||||
Di[d][p] += -q
|
Di[d][p] += -q
|
||||||
assert(Dd[d] <= T)
|
assert(Dd[d] <= T)
|
||||||
print("Drone", d, "unloads", q, "of", p, "from warehouse", w, "→", Dd[d])
|
print("Drone", d, "unloads", q, "of", p, "from warehouse", w, "→", Dd[d])
|
||||||
|
Out.append(str(d) + ' U ' + str(w) + ' ' + str(p) + ' ' + str(q))
|
||||||
|
|
||||||
def deliver(d, c, p, q):
|
def deliver(d, c, p, q):
|
||||||
# drone number, customer, product, qt
|
# drone number, customer, product, qt
|
||||||
|
@ -162,6 +164,7 @@ def deliver(d, c, p, q):
|
||||||
Dd[d] += 1
|
Dd[d] += 1
|
||||||
assert(Dd[d] <= T)
|
assert(Dd[d] <= T)
|
||||||
print("Drone", d, "delivers", q, "of", p, "to client", w, "→", Dd[d])
|
print("Drone", d, "delivers", q, "of", p, "to client", w, "→", Dd[d])
|
||||||
|
Out.append(str(d) + ' D ' + str(c) + ' ' + str(p) + ' ' + str(q))
|
||||||
|
|
||||||
def wait(d, w=1):
|
def wait(d, w=1):
|
||||||
assert(Da[d])
|
assert(Da[d])
|
||||||
|
|
Reference in a new issue