結果

問題 No.2652 [Cherry 6th Tune N] Δρονε χιρχλινγ
ユーザー miya145592miya145592
提出日時 2024-02-24 01:20:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 721 ms / 2,000 ms
コード長 813 bytes
コンパイル時間 557 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 126,516 KB
最終ジャッジ日時 2024-02-24 01:21:28
合計ジャッジ時間 46,317 ms
ジャッジサーバーID
(参考情報)
judge12 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,588 KB
testcase_01 AC 434 ms
82,808 KB
testcase_02 AC 409 ms
82,952 KB
testcase_03 AC 427 ms
84,668 KB
testcase_04 AC 581 ms
115,832 KB
testcase_05 AC 525 ms
115,264 KB
testcase_06 AC 525 ms
117,048 KB
testcase_07 AC 640 ms
117,128 KB
testcase_08 AC 661 ms
116,436 KB
testcase_09 AC 692 ms
116,524 KB
testcase_10 AC 642 ms
116,444 KB
testcase_11 AC 585 ms
116,472 KB
testcase_12 AC 625 ms
117,580 KB
testcase_13 AC 670 ms
117,532 KB
testcase_14 AC 694 ms
126,248 KB
testcase_15 AC 721 ms
120,376 KB
testcase_16 AC 685 ms
116,320 KB
testcase_17 AC 686 ms
119,448 KB
testcase_18 AC 695 ms
119,092 KB
testcase_19 AC 665 ms
116,280 KB
testcase_20 AC 638 ms
126,416 KB
testcase_21 AC 624 ms
123,216 KB
testcase_22 AC 650 ms
122,600 KB
testcase_23 AC 638 ms
126,416 KB
testcase_24 AC 654 ms
126,416 KB
testcase_25 AC 634 ms
126,416 KB
testcase_26 AC 641 ms
126,288 KB
testcase_27 AC 654 ms
126,288 KB
testcase_28 AC 675 ms
122,600 KB
testcase_29 AC 670 ms
126,516 KB
testcase_30 AC 676 ms
120,528 KB
testcase_31 AC 633 ms
121,336 KB
testcase_32 AC 643 ms
123,216 KB
testcase_33 AC 640 ms
126,416 KB
testcase_34 AC 636 ms
125,520 KB
testcase_35 AC 641 ms
126,416 KB
testcase_36 AC 658 ms
121,300 KB
testcase_37 AC 601 ms
122,060 KB
testcase_38 AC 640 ms
124,128 KB
testcase_39 AC 617 ms
126,416 KB
testcase_40 AC 373 ms
114,192 KB
testcase_41 AC 341 ms
118,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
    N, L = map(int, input().split())
    DIV = int(N**0.5) + 1
    XY = [list(map(int, input().split())) for _ in range(N)]
    Z = [[[] for _ in range(DIV+1)] for _ in range(DIV+1)]
    D = [0 for _ in range(DIV+1)]
    D[DIV] = L+1
    for i in range(1, DIV):
        D[i] = int(L/DIV*i)
    for i in range(N):
        x, y = XY[i]
        xpos = bisect.bisect_left(D, x)
        ypos = bisect.bisect_left(D, y)
        Z[xpos][ypos].append(i)
    ans = []
    for i in range(DIV+1):
        for j in range(DIV+1):
            if i%2==0:
                k = j
            else:
                k = DIV-j
            for l in Z[i][k]:
                ans.append(XY[l])
    print(len(ans))
    for a in ans:
        print(*a)
0