def solve(t, n, trees): """ Add code solving the problem here... :param n: Number of wells :param r: Radii of wells :param width: Size of the map :param height: Size of the map :param quality: Water quality :return: """ x, y = 0, 0 time = 0 while time + 1 < t and x + 1 < n: x += 1 y += 1 time += 2 print("move up") print("move right") if (x, y) in trees and time + trees[x, y]['value'] < t: print("cut up") time += trees[x, y]['value'] def read_data(): t, n, k = (int(x) for x in input().split()) trees = {} for i in range(k): x, y, h, d, c, p = (int(x) for x in input().split()) trees[x, y] = {'height' : h, 'thickness' : d, 'weight' : c, 'value' : p} return t, n, trees def main(): solve(*read_data()) if __name__ == "__main__": main()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question