結果

問題 No.1110 好きな歌
ユーザー 小野寺健小野寺健
提出日時 2021-12-20 09:21:16
言語 Go
(1.22.1)
結果
AC  
実行時間 245 ms / 5,000 ms
コード長 488 bytes
コンパイル時間 13,075 ms
コンパイル使用メモリ 213,724 KB
実行使用メモリ 10,096 KB
最終ジャッジ日時 2023-10-13 19:27:00
合計ジャッジ時間 24,751 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 1 ms
4,352 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,352 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,352 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 1 ms
4,352 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,352 KB
testcase_18 AC 1 ms
4,348 KB
testcase_19 AC 3 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,352 KB
testcase_22 AC 2 ms
4,352 KB
testcase_23 AC 1 ms
4,348 KB
testcase_24 AC 131 ms
7,916 KB
testcase_25 AC 160 ms
7,952 KB
testcase_26 AC 85 ms
5,636 KB
testcase_27 AC 161 ms
7,948 KB
testcase_28 AC 88 ms
5,640 KB
testcase_29 AC 200 ms
8,020 KB
testcase_30 AC 83 ms
5,636 KB
testcase_31 AC 53 ms
5,592 KB
testcase_32 AC 216 ms
10,072 KB
testcase_33 AC 95 ms
7,924 KB
testcase_34 AC 136 ms
7,916 KB
testcase_35 AC 205 ms
10,092 KB
testcase_36 AC 22 ms
4,348 KB
testcase_37 AC 62 ms
5,604 KB
testcase_38 AC 194 ms
8,000 KB
testcase_39 AC 142 ms
7,916 KB
testcase_40 AC 160 ms
7,952 KB
testcase_41 AC 15 ms
4,352 KB
testcase_42 AC 188 ms
10,060 KB
testcase_43 AC 192 ms
8,000 KB
testcase_44 AC 212 ms
10,088 KB
testcase_45 AC 230 ms
10,088 KB
testcase_46 AC 223 ms
10,088 KB
testcase_47 AC 242 ms
10,088 KB
testcase_48 AC 226 ms
10,096 KB
testcase_49 AC 198 ms
10,088 KB
testcase_50 AC 228 ms
10,096 KB
testcase_51 AC 217 ms
10,092 KB
testcase_52 AC 229 ms
10,088 KB
testcase_53 AC 245 ms
10,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"bufio"
	"os"
	"sort"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()
	var N, D int
	fmt.Fscan(r, &N, &D)
	a := make([]int, N)
	b := make([]int, N)
	for i := 0; i < N; i++ {
		var x int
		fmt.Fscan(r, &x)
		a[i] = x
		b[i] = x
	}
	sort.Ints(b)
	for _, x := range a {
		j := sort.Search(N, func(i int) bool { return b[i] > x - D})
		if j < N {
			fmt.Fprintln(w, j)
		} else {
			fmt.Fprintln(w, 0)
		}
	}
}
0