[PYTHON] As a result of mounting and tuning with POH! Lite

POH! Lite The result of mounting and tuning very honestly

poh-lite.py


from itertools import starmap
m = input()
n = input()
cost = {0:0}
def update(x,y):
  s,t = q+x, r+y
  if not s in cost or cost[s]>t:
    return (s,t)
for i in range(n):
  q,r = map(int,raw_input().split())
  cost.update( filter(None,starmap(update,cost.iteritems())) )
print min( (cost[x] for x in cost.keys() if x>=m) )

2.07 seconds with TEST CASE 7 It is miso that the sequence given to dict.update is listed by filter

Recommended Posts

As a result of mounting and tuning with POH! Lite
Save the result of the life game as a gif with python
Create a batch of images and inflate with ImageDataGenerator
Output the output result of sklearn.metrics.classification_report as a CSV file
Detect objects of a specific color and size with Python
Create a temporary file with django as a zip file and return it
Coexistence of Python2 and 3 with CircleCI (1.0)
Calculate the shortest route of a graph with Dijkstra's algorithm and Python
A collection of tips for speeding up learning and reasoning with PyTorch
Extract the TOP command result with USER and output it as CSV
Push the hash list into VT and receive the detection result as a list
The story of making a sound camera with Touch Designer and ReSpeaker
Make a DNN-CRF with Chainer and recognize the chord progression of music
Think of me as a 5 year old and tell me about Scikit-learn's Permutation_Importance.
Implement a model with state and behavior (3) --Example of implementation by decorator
The result was better when the training data of the mini-batch was made a hybrid of fixed and random with a neural network.
Install Python as a Framework with pyenv
Guarantee of reproducibility with keras (as of September 22, 2020)
Import of japandas with pandas 1.0 and above
A rough understanding of python-fire and a memo
A little scrutiny of pandas 1.0 and dask
A memo with Python2.7 and Python3 on CentOS
Connect a lot of Python or and and
Implement a model with state and behavior
Let's make a nervous breakdown application with Vue.js and Django-Rest-Framework [Part 3] ~ Implementation of nervous breakdown ~
How to apply updlock, rowlock, etc. with a combination of SQLAlchemy and SQLServer
Formulate a numberlink-like puzzle as a constraint satisfaction problem and solve it with a constraint solver
Practice of creating a data analysis platform with BigQuery and Cloud DataFlow (data processing)
Get the stock price of a Japanese company with Python and make a graph
Acquire the data of Mitsubishi UFJ International Investment Trust eMAXIS with Python and make a graph with the beginning of the term as 100