Browse Source

Scores added

That'll be enough for tonight.

Note that we got 213338 with the following runs
1: 8T/10
2: 8T/10
3: T/2

And we would have been 311 instead of 662 with
very few modifications
master
parent
commit
01a7f8405d
2 changed files with 11 additions and 3 deletions
  1. 2
    2
      Makefile
  2. 9
    1
      main.py

+ 2
- 2
Makefile View File

@@ -1,7 +1,7 @@
all: 1o 2o 3o ../submission.zip

../submission.zip:
zip $@ .git *.py -r
../submission.zip: 1o 2o 3o
zip $@ .git *o *.py -r

1o: 1
python main.py $<

+ 9
- 1
main.py View File

@@ -18,6 +18,7 @@ W = 0 # Nb warehouses
C = 0 # Nb customers

t = 0 # Turn
s = 0 # Score

Dp = [] # Positions of drones
# (x, y)
@@ -171,6 +172,11 @@ def deliver(d, c, p, q):
assert(Dd[d] <= T)
print("Drone", d, "delivers", q, "of", p, "to client", c, "→", Dd[d])
Out.append(str(d) + ' D ' + str(c) + ' ' + str(p) + ' ' + str(q))
# Score
if Ci[c][p] == 0:
global s
s += math.ceil((T-t)/T*100)

def wait(d, w=1):
global Dd, Da
@@ -230,7 +236,7 @@ for c in range(C):
N.append((c, p))

try:
while t < T:
while t < T-100:
for d in [d for d in range(D) if Da[d]]:
for tk in Dt[d]:
c, p = tk
@@ -276,3 +282,5 @@ def WarehouseHasItems(w, items):
if Wi[w][items[i][0]] < items[i][1]:
return False
return True

sys.stdout.write(str(s)+'\n')