結果
| 問題 |
No.447 ゆきこーだーの雨と雪 (2)
|
| ユーザー |
|
| 提出日時 | 2019-01-25 14:09:15 |
| 言語 | Nim (2.2.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,611 bytes |
| コンパイル時間 | 558 ms |
| コンパイル使用メモリ | 52,424 KB |
| 最終ジャッジ日時 | 2024-11-14 20:47:46 |
| 合計ジャッジ時間 | 1,035 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、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 = ref object
name: string
scores : seq[int]
lastSubmit: int
sum:int
proc newUser(name:string): User =
new(result)
result.name = name
result.scores = newSeq[int](n)
proc update(self:var User,pID:int,score:int,lastSumbit:int) =
self.sum += score
self.lastSubmit = lastSumbit
self.scores[pID] = score
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
users &= newUser(name)
users[userIDs[name]].update(pID,score,i)
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)