0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

B - Guidebook AtCoder

Posted at

問題

回答

N = int(input())
list = []
for i in range(N):
    s,p=input().split()
    list.append([s, int(p)])

b = sorted(list, key=lambda x:(x[0], -int(x[1])))

for i in b:
  print(list.index(i) + 1)

ポイント

ラムダ式を使用し、2次元配列の第一引数でソート→第二引数でソートをする。
新しく作成した配列とappendで作成した配列を比較し、元の配列のインデックスを出力する。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?