結果

問題 No.2803 Bocching Star
ユーザー mattu34mattu34
提出日時 2024-07-12 21:07:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 770 ms / 2,000 ms
コード長 2,495 bytes
コンパイル時間 432 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 128,256 KB
最終ジャッジ日時 2024-07-12 21:08:08
合計ジャッジ時間 19,470 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 156 ms
88,704 KB
testcase_01 AC 142 ms
88,576 KB
testcase_02 AC 139 ms
88,704 KB
testcase_03 AC 203 ms
92,416 KB
testcase_04 AC 584 ms
128,256 KB
testcase_05 AC 397 ms
114,432 KB
testcase_06 AC 186 ms
90,752 KB
testcase_07 AC 313 ms
104,064 KB
testcase_08 AC 235 ms
97,152 KB
testcase_09 AC 703 ms
125,312 KB
testcase_10 AC 684 ms
124,160 KB
testcase_11 AC 631 ms
125,028 KB
testcase_12 AC 295 ms
102,016 KB
testcase_13 AC 579 ms
128,000 KB
testcase_14 AC 492 ms
118,144 KB
testcase_15 AC 679 ms
127,104 KB
testcase_16 AC 397 ms
114,176 KB
testcase_17 AC 227 ms
95,616 KB
testcase_18 AC 204 ms
94,080 KB
testcase_19 AC 580 ms
126,760 KB
testcase_20 AC 410 ms
114,432 KB
testcase_21 AC 353 ms
108,288 KB
testcase_22 AC 325 ms
106,368 KB
testcase_23 AC 665 ms
123,520 KB
testcase_24 AC 768 ms
123,136 KB
testcase_25 AC 735 ms
123,520 KB
testcase_26 AC 714 ms
123,392 KB
testcase_27 AC 716 ms
123,264 KB
testcase_28 AC 753 ms
123,520 KB
testcase_29 AC 708 ms
123,136 KB
testcase_30 AC 709 ms
123,520 KB
testcase_31 AC 728 ms
123,520 KB
testcase_32 AC 770 ms
123,264 KB
testcase_33 AC 156 ms
89,600 KB
testcase_34 AC 154 ms
89,600 KB
testcase_35 AC 157 ms
89,600 KB
testcase_36 AC 155 ms
89,920 KB
testcase_37 AC 157 ms
89,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
import sys
import heapq
from heapq import heapify, heappop, heappush
import bisect
import itertools
from functools import lru_cache
from types import GeneratorType
from fractions import Fraction
import math
import copy
import random

# import numpy as np

# sys.setrecursionlimit(int(1e7))
# @lru_cache(maxsize=None) # CPython特化
# @bootstrap # PyPy特化(こっちのほうが速い) yield dfs(), yield Noneを忘れずに


def bootstrap(f, stack=[]):  # yield
    def wrappedfunc(*args, **kwargs):
        if stack:
            return f(*args, **kwargs)
        else:
            to = f(*args, **kwargs)
            while True:
                if type(to) is GeneratorType:
                    stack.append(to)
                    to = next(to)
                else:
                    stack.pop()
                    if not stack:
                        break
                    to = stack[-1].send(to)
            return to

    return wrappedfunc


dxdy1 = ((0, 1), (0, -1), (1, 0), (-1, 0))  # 上下右左
dxdy2 = (
    (0, 1),
    (0, -1),
    (1, 0),
    (-1, 0),
    (1, 1),
    (-1, -1),
    (1, -1),
    (-1, 1),
)  # 8方向すべて
dxdy3 = ((0, 1), (1, 0))  # 右 or 下
dxdy4 = ((1, 1), (1, -1), (-1, 1), (-1, -1))  # 斜め
INF = float("inf")
_INF = 1 << 60
MOD = 998244353
mod = 998244353
MOD2 = 10**9 + 7
mod2 = 10**9 + 7
# memo : len([a,b,...,z])==26
# memo : 2^20 >= 10^6
# 小数の計算を避ける : x/y -> (x*big)//y  ex:big=10**9
# @:小さい文字, ~:大きい文字,None: 空の文字列
# ユークリッドの互除法:gcd(x,y)=gcd(x,y-x)
# memo : d 桁以下の p 進表記を用いると p^d-1 以下のすべての
#        非負整数を表現することができる
# memo : (X,Y) -> (X+Y,X−Y) <=> 点を原点を中心に45度回転し、√2倍に拡大
# memo : (x,y)のx正から見た偏角をラジアンで(-πからπ]: math.atan2(y, x)
# memo : a < bのとき ⌊a⌋ ≦ ⌊b⌋

input = lambda: sys.stdin.readline().rstrip()
mi = lambda: map(int, input().split())
li = lambda: list(mi())
ii = lambda: int(input())
py = lambda: print("Yes")
pn = lambda: print("No")
pf = lambda: print("First")
ps = lambda: print("Second")


N, S = mi()
tmp = li()
p = [(t, i + 1) for i, t in enumerate(tmp)]
P = [(-INF, -10)] + p + [(INF, INF)]
P.sort()
ans = []
for i in range(N):
    if P[i + 1][0] - P[i][0] > S and P[i + 2][0] - P[i + 1][0] > S:
        ans.append(P[i + 1][1])
ans.sort()
print(len(ans))
print(*ans)
0