結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
53,588 KB
testcase_01 AC 460 ms
82,684 KB
testcase_02 AC 452 ms
82,824 KB
testcase_03 AC 485 ms
84,544 KB
testcase_04 AC 628 ms
115,704 KB
testcase_05 AC 602 ms
115,140 KB
testcase_06 AC 623 ms
116,928 KB
testcase_07 AC 751 ms
117,004 KB
testcase_08 AC 750 ms
116,312 KB
testcase_09 AC 754 ms
116,400 KB
testcase_10 AC 749 ms
116,316 KB
testcase_11 AC 749 ms
116,344 KB
testcase_12 AC 714 ms
117,460 KB
testcase_13 AC 750 ms
117,404 KB
testcase_14 AC 741 ms
126,120 KB
testcase_15 AC 739 ms
120,296 KB
testcase_16 AC 710 ms
116,196 KB
testcase_17 AC 761 ms
119,316 KB
testcase_18 AC 779 ms
119,008 KB
testcase_19 AC 805 ms
116,264 KB
testcase_20 AC 760 ms
126,416 KB
testcase_21 AC 772 ms
123,216 KB
testcase_22 AC 722 ms
122,472 KB
testcase_23 AC 699 ms
126,416 KB
testcase_24 AC 697 ms
126,416 KB
testcase_25 AC 730 ms
126,416 KB
testcase_26 AC 723 ms
126,288 KB
testcase_27 AC 703 ms
126,288 KB
testcase_28 AC 724 ms
122,472 KB
testcase_29 AC 716 ms
126,528 KB
testcase_30 AC 696 ms
120,272 KB
testcase_31 AC 702 ms
121,456 KB
testcase_32 AC 716 ms
123,216 KB
testcase_33 AC 751 ms
126,416 KB
testcase_34 AC 719 ms
125,392 KB
testcase_35 AC 730 ms
126,416 KB
testcase_36 AC 712 ms
121,172 KB
testcase_37 AC 700 ms
121,932 KB
testcase_38 AC 741 ms
123,996 KB
testcase_39 AC 756 ms
126,416 KB
testcase_40 AC 418 ms
114,068 KB
testcase_41 AC 439 ms
118,864 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