結果

問題 No.2652 [Cherry 6th Tune N] Δρονε χιρχλινγ
ユーザー nikoro256nikoro256
提出日時 2024-02-24 00:06:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 664 ms / 2,000 ms
コード長 719 bytes
コンパイル時間 406 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 113,572 KB
最終ジャッジ日時 2024-02-24 00:07:40
合計ジャッジ時間 45,569 ms
ジャッジサーバーID
(参考情報)
judge16 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
55,732 KB
testcase_01 AC 497 ms
79,344 KB
testcase_02 AC 477 ms
79,344 KB
testcase_03 AC 484 ms
79,724 KB
testcase_04 AC 596 ms
93,948 KB
testcase_05 AC 573 ms
92,428 KB
testcase_06 AC 550 ms
95,652 KB
testcase_07 AC 629 ms
98,580 KB
testcase_08 AC 635 ms
98,976 KB
testcase_09 AC 628 ms
99,200 KB
testcase_10 AC 619 ms
99,312 KB
testcase_11 AC 664 ms
99,176 KB
testcase_12 AC 636 ms
99,104 KB
testcase_13 AC 657 ms
102,560 KB
testcase_14 AC 614 ms
112,688 KB
testcase_15 AC 653 ms
106,052 KB
testcase_16 AC 638 ms
98,844 KB
testcase_17 AC 636 ms
103,000 KB
testcase_18 AC 616 ms
103,472 KB
testcase_19 AC 625 ms
100,128 KB
testcase_20 AC 594 ms
113,456 KB
testcase_21 AC 639 ms
113,456 KB
testcase_22 AC 659 ms
113,440 KB
testcase_23 AC 618 ms
113,440 KB
testcase_24 AC 583 ms
113,440 KB
testcase_25 AC 597 ms
113,440 KB
testcase_26 AC 580 ms
113,440 KB
testcase_27 AC 615 ms
113,572 KB
testcase_28 AC 616 ms
113,440 KB
testcase_29 AC 592 ms
113,440 KB
testcase_30 AC 599 ms
113,452 KB
testcase_31 AC 602 ms
113,440 KB
testcase_32 AC 617 ms
113,568 KB
testcase_33 AC 624 ms
113,440 KB
testcase_34 AC 598 ms
113,456 KB
testcase_35 AC 636 ms
113,440 KB
testcase_36 AC 604 ms
113,440 KB
testcase_37 AC 629 ms
113,440 KB
testcase_38 AC 624 ms
113,440 KB
testcase_39 AC 613 ms
113,440 KB
testcase_40 AC 474 ms
107,940 KB
testcase_41 AC 382 ms
113,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solveans(dat):
    last=dat[0][1]
    ans=L
    for i in range(1,N):
        ans+=abs(last-dat[i][1])
    ans+=dat[i][-1]
    return ans

from collections import defaultdict
import math
T=int(input())
for _ in range(T):
    N,L=map(int,input().split())
    dat=defaultdict(list)
    sl=(L//math.sqrt(N))
    for _ in range(N):
        x,y=map(int,input().split())
        dat[(y//sl)].append([x,y])
    count=0
    keys=sorted(dat.keys())
    for k in keys:
        if count%2==0:
            dat[k].sort()
        else:
            dat[k].sort(reverse=True)
        count+=1
    ans=[]
    for k in keys:
        for d in dat[k]:
            ans.append(d)
    print(len(ans))
    for a,b in ans:
        print(a,b)
0