結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー McGregorshMcGregorsh
提出日時 2022-10-28 09:22:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 216 ms / 2,000 ms
コード長 2,721 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 81,956 KB
実行使用メモリ 94,208 KB
最終ジャッジ日時 2024-07-05 15:40:59
合計ジャッジ時間 7,054 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
89,296 KB
testcase_01 AC 134 ms
89,344 KB
testcase_02 AC 134 ms
89,216 KB
testcase_03 AC 169 ms
90,196 KB
testcase_04 AC 171 ms
90,112 KB
testcase_05 AC 204 ms
92,752 KB
testcase_06 AC 207 ms
93,184 KB
testcase_07 AC 184 ms
91,312 KB
testcase_08 AC 202 ms
92,032 KB
testcase_09 AC 207 ms
93,184 KB
testcase_10 AC 171 ms
90,008 KB
testcase_11 AC 179 ms
91,468 KB
testcase_12 AC 198 ms
92,156 KB
testcase_13 AC 205 ms
93,304 KB
testcase_14 AC 210 ms
93,312 KB
testcase_15 AC 184 ms
91,280 KB
testcase_16 AC 158 ms
90,112 KB
testcase_17 AC 175 ms
91,016 KB
testcase_18 AC 161 ms
89,984 KB
testcase_19 AC 214 ms
93,312 KB
testcase_20 AC 215 ms
94,208 KB
testcase_21 AC 180 ms
91,264 KB
testcase_22 AC 181 ms
91,292 KB
testcase_23 AC 183 ms
91,520 KB
testcase_24 AC 209 ms
92,648 KB
testcase_25 AC 216 ms
92,744 KB
testcase_26 AC 186 ms
91,464 KB
testcase_27 AC 187 ms
91,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, re
from fractions import Fraction
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque, defaultdict
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement, permutations
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext, ROUND_HALF_UP
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
def get_distance(x1, y1, x2, y2):
	  d = sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
	  return d
def rotate(table):
   	  n_fild = []
   	  for x in zip(*table[::-1]):
   	  	  n_fild.append(x)
   	  return n_fild
sys.setrecursionlimit(10 ** 7)
INF = float('inf')
MOD = 10 ** 9 + 7
MOD2 = 998244353


###関数コピーしたか?###
def main():
   
   def score(x, rank):
   	  return int(50 * x + (50 * x / (0.8 + 0.2 * rank)))
   
   names = set()
   N = int(input())
   L = i_list()
   T = int(input())
   query = []
   for i in range(T):
   	  name, p = s_map()
   	  names.add(name)
   	  query.append([name, p])
   
   renum = defaultdict(int)
   mozi = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
   for i in range(26):
   	  renum[mozi[i]] = i
   
   names = list(names)
   members = defaultdict(int)
   remembers = defaultdict(list)
   for i in range(len(names)):
   	  members[names[i]] = i
   	  remembers[i].append(names[i])
   
   AC_num = [0] * N
   
   scores = [[0] * 26 for i in range(len(names))]
   last = [0] * len(names)
   for i in range(T):
   	  a, b = query[i]
   	  point = members[a]
   	  point1 = renum[b]
   	  AC_num[point1] += 1
   	  point2 = AC_num[point1]
   	  cost = score(L[point1], point2)
   	  scores[point][point1] = cost
   	  last[point] = i
   
   ans = []
   for i in range(len(names)):
   	  human = remembers[i][0]
   	  total = 0
   	  for j in range(N):
   	  	  total += scores[i][j]
   	  ans.append([-total, last[i], human])
   #print(ans)
   ans.sort(key=lambda x:(x[0], x[1]))
   for i in range(len(names)):
   	  lank = i+1
   	  hu = ans[i][2]
   	  cost1 = -ans[i][0]
   	  point3 = members[hu]
   	  print(lank, hu, *scores[point3][:N], cost1)
   
   
if __name__ == '__main__':
    main()
0