結果
| 問題 |
No.447 ゆきこーだーの雨と雪 (2)
|
| ユーザー |
|
| 提出日時 | 2019-01-25 14:01:19 |
| 言語 | Nim (2.2.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,516 bytes |
| コンパイル時間 | 555 ms |
| コンパイル使用メモリ | 53,640 KB |
| 最終ジャッジ日時 | 2024-11-14 20:47:47 |
| 合計ジャッジ時間 | 901 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
/home/judge/data/code/Main.nim(2, 21) Error: cannot open file: queues
ソースコード
import sequtils,algorithm,math,tables,sugar
import sets,intsets,queues,heapqueue,bitops,strutils
proc printf(formatstr: cstring){.header: "<stdio.h>", varargs.}
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
while true:
let k = getchar_unlocked()
if k < '0': break
result = 10 * result + k.ord - '0'.ord
proc scanName(): string =
result = ""
while true:
let k = getchar_unlocked()
if k == ' ': return
result &= k
proc calcScore(star:int,ac:int):int = 50 * star + (50 * star) * 5 div (4 + ac)
let n = scan()
let L = newSeqWith(n,scan())
var AC = newSeqWith(n,1)
type User = tuple[
name: string,
scores : seq[int],
lastSubmit: int,
sum:int
]
var maxID = 0
var userIDs = newTable[string,int]()
var users = newSeq[User]()
for i in 0..<scan():
let name = scanName()
let pID = getchar_unlocked().ord - 'A'.ord
discard getchar_unlocked()
let score = calcScore(L[pID],AC[pID])
AC[pID] += 1
if name notin userIDs:
let id = maxID
userIDs[name] = id
maxID += 1
var scores = newSeq[int](n)
scores[pID] = score
users &= (name,scores,i,score)
else:
let id = userIDs[name]
users[id].scores[pID] = score
users[id].lastSubmit = i
users[id].sum += score
users.sort(proc(x,y:User):int =
if x.sum != y.sum : y.sum - x.sum
else: x.lastSubmit - y.lastSubmit
)
for i,u in users:
printf("%d %s ",i+1,u.name.cstring)
for score in u.scores: printf("%d ",score)
printf("%d\n", u.sum)