結果
問題 | No.210 探し物はどこですか? |
ユーザー | aru aru |
提出日時 | 2020-09-16 14:15:18 |
言語 | Go (1.22.1) |
結果 |
AC
|
実行時間 | 250 ms / 2,000 ms |
コード長 | 1,921 bytes |
コンパイル時間 | 13,989 ms |
コンパイル使用メモリ | 213,300 KB |
実行使用メモリ | 8,224 KB |
最終ジャッジ日時 | 2023-09-04 03:29:36 |
合計ジャッジ時間 | 26,502 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 186 ms
8,224 KB |
testcase_01 | AC | 209 ms
8,216 KB |
testcase_02 | AC | 218 ms
8,220 KB |
testcase_03 | AC | 242 ms
8,212 KB |
testcase_04 | AC | 229 ms
8,208 KB |
testcase_05 | AC | 243 ms
8,212 KB |
testcase_06 | AC | 245 ms
8,212 KB |
testcase_07 | AC | 244 ms
8,208 KB |
testcase_08 | AC | 178 ms
8,208 KB |
testcase_09 | AC | 181 ms
8,208 KB |
testcase_10 | AC | 181 ms
8,208 KB |
testcase_11 | AC | 203 ms
8,208 KB |
testcase_12 | AC | 205 ms
8,208 KB |
testcase_13 | AC | 229 ms
8,224 KB |
testcase_14 | AC | 249 ms
8,220 KB |
testcase_15 | AC | 240 ms
8,220 KB |
testcase_16 | AC | 241 ms
8,224 KB |
testcase_17 | AC | 246 ms
8,220 KB |
testcase_18 | AC | 202 ms
8,220 KB |
testcase_19 | AC | 202 ms
8,220 KB |
testcase_20 | AC | 204 ms
8,216 KB |
testcase_21 | AC | 202 ms
8,224 KB |
testcase_22 | AC | 201 ms
8,224 KB |
testcase_23 | AC | 234 ms
8,212 KB |
testcase_24 | AC | 239 ms
8,212 KB |
testcase_25 | AC | 241 ms
8,212 KB |
testcase_26 | AC | 238 ms
8,216 KB |
testcase_27 | AC | 230 ms
8,212 KB |
testcase_28 | AC | 247 ms
8,216 KB |
testcase_29 | AC | 245 ms
8,212 KB |
testcase_30 | AC | 244 ms
8,212 KB |
testcase_31 | AC | 247 ms
8,212 KB |
testcase_32 | AC | 245 ms
8,212 KB |
testcase_33 | AC | 249 ms
8,220 KB |
testcase_34 | AC | 247 ms
8,220 KB |
testcase_35 | AC | 249 ms
8,216 KB |
testcase_36 | AC | 244 ms
8,220 KB |
testcase_37 | AC | 246 ms
8,224 KB |
testcase_38 | AC | 247 ms
8,220 KB |
testcase_39 | AC | 249 ms
8,220 KB |
testcase_40 | AC | 249 ms
8,220 KB |
testcase_41 | AC | 250 ms
8,208 KB |
testcase_42 | AC | 248 ms
8,220 KB |
testcase_43 | AC | 87 ms
8,204 KB |
testcase_44 | AC | 97 ms
8,212 KB |
testcase_45 | AC | 233 ms
8,208 KB |
ソースコード
package main import ( "bufio" "container/heap" "fmt" "os" "sort" "strconv" ) func out(x ...interface{}) { fmt.Println(x...) } var sc = bufio.NewScanner(os.Stdin) func getInt() int { sc.Scan() i, e := strconv.Atoi(sc.Text()) if e != nil { panic(e) } return i } func getInts(N int) []int { ret := make([]int, N) for i := 0; i < N; i++ { ret[i] = getInt() } return ret } func getString() string { sc.Scan() return sc.Text() } // min, max, asub, absなど基本関数 func max(a, b int) int { if a > b { return a } return b } func min(a, b int) int { if a < b { return a } return b } func asub(a, b int) int { if a > b { return a - b } return b - a } func abs(a int) int { if a >= 0 { return a } return -a } func lowerBound(a []int, x int) int { idx := sort.Search(len(a), func(i int) bool { return a[i] >= x }) return idx } func upperBound(a []int, x int) int { idx := sort.Search(len(a), func(i int) bool { return a[i] > x }) return idx } type pqi struct { p float64 n int } type priorityQueue []pqi func (pq priorityQueue) Len() int { return len(pq) } func (pq priorityQueue) Swap(i, j int) { pq[i], pq[j] = pq[j], pq[i] } func (pq priorityQueue) Less(i, j int) bool { return pq[i].p > pq[j].p } func (pq *priorityQueue) Push(x interface{}) { *pq = append(*pq, x.(pqi)) } func (pq *priorityQueue) Pop() interface{} { x := (*pq)[len(*pq)-1] *pq = (*pq)[0 : len(*pq)-1] return x } func main() { sc.Split(bufio.ScanWords) sc.Buffer([]byte{}, 1000000) n := getInt() p := getInts(n) q := getInts(n) pq := priorityQueue{} for i := 0; i < n; i++ { x := float64(p[i]*q[i]) / 100000.0 heap.Push(&pq, pqi{x, i}) } ret := 0.0 for i := 0; i < 1000000; i++ { if len(pq) != 0 { r := heap.Pop(&pq).(pqi) ret += float64(i+1) * r.p x := r.p * (1 - float64(q[r.n])/100.0) heap.Push(&pq, pqi{x, r.n}) } } out(ret) }