Created
February 17, 2014 20:28
-
-
Save lexs/9058471 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def create_track(position, value, name): | |
quality = position * int(value) | |
# Use a negative position for order | |
return (quality, -position, name) | |
def main(): | |
n, m = map(int, sys.stdin.readline().split()) | |
tracks = [create_track(i, *line.split()) for i, line in enumerate(sys.stdin, start=1)] | |
for _, _, name in sorted(tracks, reverse=True)[:m]: | |
print name | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment