Merge branch 'master' of http://git.fuwafuwa.moe/triggerzone/google-meme-code-2017
This commit is contained in:
commit
b27520b4bb
33
input.py
33
input.py
|
@ -9,39 +9,38 @@ with open(filename) as file:
|
||||||
|
|
||||||
tokenised = [line.strip().split() for line in text]
|
tokenised = [line.strip().split() for line in text]
|
||||||
|
|
||||||
videoCount = tokenised[0][0]
|
videoCount = int(tokenised[0][0])
|
||||||
endpointCount = tokenised[0][1]
|
endpointCount = int(tokenised[0][1])
|
||||||
requestDescriptionCount = tokenised[0][2]
|
requestDescriptionCount = int(tokenised[0][2])
|
||||||
cacheCount = tokenised[0][3]
|
cacheCount = int(tokenised[0][3])
|
||||||
cacheSize = tokenised[0][4]
|
cacheSize = int(tokenised[0][4])
|
||||||
|
|
||||||
videoSizes = tokenised[1]
|
videoSizes = tokenised[1]
|
||||||
|
|
||||||
endpointDatacenterLatencies = []
|
endpointDatacenterLatencies = []
|
||||||
endpointCacheLatencies = []
|
endpointCacheLatencies = []
|
||||||
i = 2
|
i = 2
|
||||||
for endpoint in range(0, int(endpointCount)):
|
for endpoint in range(0, endpointCount):
|
||||||
endpointDatacenterLatencies.append(tokenised[endpoint + i][0])
|
datacenterLatency = int(tokenised[endpoint + i][0])
|
||||||
|
endpointDatacenterLatencies.append(datacenterLatency)
|
||||||
|
|
||||||
endpointCacheLatencies.append({})
|
endpointCacheLatencies.append({})
|
||||||
endpointCacheCount = tokenised[endpoint + i][1]
|
endpointCacheCount = int(tokenised[endpoint + i][1])
|
||||||
for cache in range(0, int(endpointCacheCount)):
|
for cache in range(0, endpointCacheCount):
|
||||||
cacheId = tokenised[endpoint + 1 + cache + i][0]
|
cacheId = int(tokenised[endpoint + 1 + cache + i][0])
|
||||||
cacheLatency = tokenised[endpoint + 1 + cache + i][1]
|
cacheLatency = int(tokenised[endpoint + 1 + cache + i][1])
|
||||||
endpointCacheLatencies[endpoint][cacheId] = cacheLatency
|
endpointCacheLatencies[endpoint][cacheId] = cacheLatency
|
||||||
i += int(endpointCacheCount)
|
i += endpointCacheCount
|
||||||
|
|
||||||
|
|
||||||
i += int(endpointCount)
|
i += endpointCount
|
||||||
|
|
||||||
requestDescriptions = []
|
requestDescriptions = []
|
||||||
for video in range(0, int(videoCount)):
|
for video in range(0, videoCount):
|
||||||
requestDescriptions.append({})
|
requestDescriptions.append({})
|
||||||
|
|
||||||
for requestDescription in range(0, int(requestDescriptionCount)):
|
for requestDescription in range(0, requestDescriptionCount):
|
||||||
video = int(tokenised[i + requestDescription][0])
|
video = int(tokenised[i + requestDescription][0])
|
||||||
endpoint = int(tokenised[i + requestDescription][1])
|
endpoint = int(tokenised[i + requestDescription][1])
|
||||||
requestCount = int(tokenised[i + requestDescription][2])
|
requestCount = int(tokenised[i + requestDescription][2])
|
||||||
requestDescriptions[video][endpoint] = requestCount
|
requestDescriptions[video][endpoint] = requestCount
|
||||||
|
|
||||||
print(requestDescriptions)
|
|
||||||
|
|
Loading…
Reference in New Issue