結果

問題 No.2652 [Cherry 6th Tune N] Δρονε χιρχλινγ
ユーザー 👑 KazunKazun
提出日時 2023-07-06 01:43:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 398 ms / 2,000 ms
コード長 843 bytes
コンパイル時間 497 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 100,304 KB
最終ジャッジ日時 2023-12-25 00:34:28
合計ジャッジ時間 37,544 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
55,756 KB
testcase_01 AC 310 ms
77,888 KB
testcase_02 AC 310 ms
78,016 KB
testcase_03 AC 305 ms
78,016 KB
testcase_04 AC 331 ms
82,884 KB
testcase_05 AC 328 ms
82,796 KB
testcase_06 AC 344 ms
82,956 KB
testcase_07 AC 353 ms
87,104 KB
testcase_08 AC 368 ms
86,728 KB
testcase_09 AC 353 ms
89,536 KB
testcase_10 AC 353 ms
88,460 KB
testcase_11 AC 377 ms
87,764 KB
testcase_12 AC 358 ms
87,240 KB
testcase_13 AC 359 ms
91,584 KB
testcase_14 AC 396 ms
99,776 KB
testcase_15 AC 366 ms
93,160 KB
testcase_16 AC 362 ms
87,768 KB
testcase_17 AC 395 ms
92,108 KB
testcase_18 AC 370 ms
90,868 KB
testcase_19 AC 357 ms
90,688 KB
testcase_20 AC 369 ms
100,304 KB
testcase_21 AC 361 ms
99,136 KB
testcase_22 AC 380 ms
100,288 KB
testcase_23 AC 371 ms
99,136 KB
testcase_24 AC 358 ms
98,880 KB
testcase_25 AC 385 ms
99,136 KB
testcase_26 AC 361 ms
99,264 KB
testcase_27 AC 367 ms
99,392 KB
testcase_28 AC 359 ms
99,904 KB
testcase_29 AC 356 ms
100,160 KB
testcase_30 AC 383 ms
99,008 KB
testcase_31 AC 359 ms
100,288 KB
testcase_32 AC 356 ms
99,264 KB
testcase_33 AC 398 ms
99,520 KB
testcase_34 AC 359 ms
99,520 KB
testcase_35 AC 364 ms
99,136 KB
testcase_36 AC 367 ms
99,520 KB
testcase_37 AC 368 ms
100,288 KB
testcase_38 AC 394 ms
99,536 KB
testcase_39 AC 366 ms
99,264 KB
testcase_40 AC 283 ms
95,424 KB
testcase_41 AC 237 ms
89,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt
from collections import defaultdict
from operator import itemgetter

def solve():
    N, L = map(int, input().split())

    B = round(L / sqrt(N))
    block = defaultdict(list)

    for i in range(N):
        X, Y = map(int, input().split())

        if Y == 0:
            j = 0
        else:
            j = (Y-1)//B
        block[j].append((X,Y))

    A = []
    for j in sorted(block.keys()):
        if j % 2 == 0:
            block[j].sort(key=itemgetter(0))
        else:
            block[j].sort(key=itemgetter(0), reverse=True)
        A.extend(block[j])

    print(len(A))
    for x,y in A:
        print(x,y)

#==================================================
import sys
input=sys.stdin.readline
write=sys.stdout.write

T = int(input())
for t in range(T):
    solve()
0