import sequtils,algorithm,math,tables,sugar import sets,intsets,queues,heapqueue,bitops,strutils proc printf(formatstr: cstring){.header: "", varargs.} proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "" .} 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..