Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- # file_in = '27-demo.txt' # 32
- file_in = '27-B_demo.txt' # 399762080
- # file_in = '27-A_demo.txt' # 127127
- x = np.fromfile(file_in, sep=' ', dtype=np.int16)
- count = x[0]
- array = x[1:].reshape(count, 2)
- array = np.sort(array)
- sum_ = array[:, 1].sum()
- array = np.array(sorted(array.tolist(), key=lambda x: x[1] - x[0])).reshape(count, 2)
- for elem in array:
- if (sum_ - elem[1] + elem[0]) % 3 != 0:
- break
- print(sum_ - elem[1] + elem[0])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement