結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー titia
提出日時 2023-06-19 02:40:32
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 936 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 13,440 KB
最終ジャッジ日時 2024-06-26 13:16:19
合計ジャッジ時間 2,898 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

from operator import itemgetter

N=int(input())
L=list(map(int,input().split()))
T=int(input())
A=[input().split() for i in range(T)]

LIST=[]
SET=set()

for a,b in A:
    if a in SET:
        continue
    SET.add(a)
    LIST.append(a)

DICT={LIST[i]:i for i in range(len(LIST))}

POINT=[[0]*(len(L)+1)+[i] for i in range(len(LIST))]

JUNI=[0]*N

for time in range(len(A)):
    a,b=A[time]

    x=ord(b)-65
    j=JUNI[x]
    k=DICT[a]

    score=L[x]*50+L[x]*500//(8+2*(j+1))

    JUNI[x]+=1

    POINT[k][x]=score
    POINT[k][-2]=time

for i in range(len(POINT)):
    POINT[i].append(sum(POINT[i][:-2]))

POINT.sort(key=itemgetter(len(POINT[0])-3))
POINT.sort(key=itemgetter(len(POINT[0])-1),reverse=True)

for i in range(len(POINT)):
    X=[]
    X.append(i+1)
    X.append(LIST[POINT[i][-2]])
    for j in range(N):
        X.append(POINT[i][j])
    X.append(POINT[i][-1])

    print(*X)
    
0