結果

問題 No.2803 Bocching Star
ユーザー _a_a
提出日時 2024-07-12 22:55:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 557 ms / 2,000 ms
コード長 2,316 bytes
コンパイル時間 466 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 61,184 KB
最終ジャッジ日時 2024-07-12 22:55:30
合計ジャッジ時間 14,157 ms
ジャッジサーバーID
(参考情報)
judge6 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
11,904 KB
testcase_01 AC 36 ms
11,904 KB
testcase_02 AC 37 ms
11,904 KB
testcase_03 AC 70 ms
16,984 KB
testcase_04 AC 436 ms
45,412 KB
testcase_05 AC 245 ms
32,324 KB
testcase_06 AC 72 ms
15,104 KB
testcase_07 AC 163 ms
25,316 KB
testcase_08 AC 101 ms
19,044 KB
testcase_09 AC 516 ms
53,256 KB
testcase_10 AC 551 ms
53,524 KB
testcase_11 AC 473 ms
52,972 KB
testcase_12 AC 142 ms
24,200 KB
testcase_13 AC 464 ms
42,232 KB
testcase_14 AC 280 ms
35,140 KB
testcase_15 AC 435 ms
52,416 KB
testcase_16 AC 244 ms
33,548 KB
testcase_17 AC 94 ms
18,472 KB
testcase_18 AC 83 ms
17,204 KB
testcase_19 AC 436 ms
42,912 KB
testcase_20 AC 246 ms
30,900 KB
testcase_21 AC 205 ms
26,828 KB
testcase_22 AC 177 ms
27,184 KB
testcase_23 AC 526 ms
50,728 KB
testcase_24 AC 557 ms
61,184 KB
testcase_25 AC 533 ms
57,684 KB
testcase_26 AC 545 ms
58,784 KB
testcase_27 AC 510 ms
53,236 KB
testcase_28 AC 549 ms
57,124 KB
testcase_29 AC 531 ms
52,000 KB
testcase_30 AC 547 ms
59,344 KB
testcase_31 AC 535 ms
54,292 KB
testcase_32 AC 530 ms
61,008 KB
testcase_33 AC 37 ms
12,160 KB
testcase_34 AC 37 ms
12,288 KB
testcase_35 AC 35 ms
12,288 KB
testcase_36 AC 37 ms
12,160 KB
testcase_37 AC 37 ms
12,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import os, sys
import math, decimal, queue, heapq, bisect, itertools, functools, collections, string
from bisect import bisect, bisect_left
from collections import defaultdict, OrderedDict, deque, Counter
from functools import cmp_to_key, lru_cache, reduce
from heapq import heapify, heappush, heappushpop, heappop, heapreplace, nlargest, nsmallest
from itertools import accumulate, chain, combinations, combinations_with_replacement, compress, count, cycle, dropwhile, filterfalse, groupby, islice, permutations, product, repeat, starmap, takewhile, tee, zip_longest
from math import gcd, factorial, isqrt, comb, perm, prod, inf
from queue import Queue, PriorityQueue, LifoQueue
from string import ascii_letters, ascii_lowercase, ascii_uppercase, digits, hexdigits, octdigits

az, AZ, mod = ascii_lowercase, ascii_uppercase, 1_000_000_007


def solve():
    def run(W):
        n, s = W[0]
        p = sorted((n, i + 1) for i, n in enumerate(W[1]))
        if len(p) < 2:
            print(1)
            print(1)
        else:
            res = []
            # P(p, n, s, '\n')
            lo, hi = set(), set()
            for i, (st, idx) in enumerate(p):
                if i == 0:
                    continue
                dist = abs(p[i][0] - p[i - 1][0])
                if dist <= s:
                    lo.update({p[i][1], p[i - 1][1]})

            s = sorted(lo)

            j = 0
            for i in range(1, n + 1):
                if j < len(s) and s[j] == i:
                    j += 1
                else:
                    res.append(i)

            print(len(res))
            PI(*res)
            # PI(i, st, idx, res, lo, '\n')

    run(W)


if __name__ == '__main__':
    LOCAL = sys.argv[0] if '4a' in sys.argv[0] else None

    P = lambda *p: [print(i, end='  ') for i in p] if LOCAL else None
    PI = lambda *p: print(' '.join(map(str, p))) or None
    PII = lambda X: [PI(*row) for row in X]

    sys.stdin = open(os.path.join(os.getcwd(), 'a1.txt'), 'r') if LOCAL else sys.stdin
    I = lambda: [int(a) for l in sys.stdin for a in l.strip().split()]
    S = lambda: [a for l in sys.stdin for a in l.strip().split()]
    IM = lambda: [[int(a) for a in l.split()] for l in sys.stdin]
    SM = lambda: [[a for a in l.split()] for l in sys.stdin]
    W = IM()
    # P(W)
    solve()
0