結果
問題 |
No.2590 100000 Days of Christmas
|
ユーザー |
![]() |
提出日時 | 2024-11-11 22:18:21 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 113 ms / 2,000 ms |
コード長 | 705 bytes |
コンパイル時間 | 13,601 ms |
コンパイル使用メモリ | 228,912 KB |
実行使用メモリ | 12,672 KB |
最終ジャッジ日時 | 2024-11-11 22:18:39 |
合計ジャッジ時間 | 16,301 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
package main import . "fmt" import . "os" import bf "bufio" import . "slices" func main() { rd:=bf.NewReader(Stdin) wr:=bf.NewWriter(Stdout) var line = new(Line) Fscan(rd,line) var n int Sscan(line.s,&n) m:=make(map[string]int64) p:=make([]string,n) for i:=range p { Fscan(rd,line) c:=int64(i+1)*int64(n-i) p[i]=line.s m[line.s]+=c } Sort(p) p=Compact(p) for _,s:=range p { Fprintln(wr,m[s],s) } wr.Flush() } type Line struct { s string } func (l *Line) Scan(st ScanState, verb rune) error { token, _ := st.Token(false, func(r rune) bool { return r != '\n' }) l.s = string(token) _, _, err := st.ReadRune() return err } func (l *Line) String() string { return l.s }