結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
55,604 KB
testcase_01 AC 506 ms
79,344 KB
testcase_02 AC 496 ms
79,344 KB
testcase_03 AC 481 ms
79,596 KB
testcase_04 AC 564 ms
93,820 KB
testcase_05 AC 573 ms
92,120 KB
testcase_06 AC 576 ms
95,516 KB
testcase_07 AC 626 ms
98,512 KB
testcase_08 AC 615 ms
98,876 KB
testcase_09 AC 673 ms
99,080 KB
testcase_10 AC 597 ms
99,460 KB
testcase_11 AC 628 ms
99,056 KB
testcase_12 AC 633 ms
98,968 KB
testcase_13 AC 702 ms
102,432 KB
testcase_14 AC 614 ms
112,560 KB
testcase_15 AC 618 ms
105,900 KB
testcase_16 AC 616 ms
98,832 KB
testcase_17 AC 613 ms
102,872 KB
testcase_18 AC 654 ms
103,344 KB
testcase_19 AC 643 ms
100,128 KB
testcase_20 AC 629 ms
113,328 KB
testcase_21 AC 599 ms
113,456 KB
testcase_22 AC 606 ms
113,312 KB
testcase_23 AC 600 ms
113,312 KB
testcase_24 AC 617 ms
113,312 KB
testcase_25 AC 613 ms
113,312 KB
testcase_26 AC 599 ms
113,312 KB
testcase_27 AC 593 ms
113,316 KB
testcase_28 AC 595 ms
113,312 KB
testcase_29 AC 618 ms
113,312 KB
testcase_30 AC 617 ms
113,324 KB
testcase_31 AC 611 ms
113,312 KB
testcase_32 AC 615 ms
113,440 KB
testcase_33 AC 598 ms
113,312 KB
testcase_34 AC 630 ms
113,328 KB
testcase_35 AC 624 ms
113,312 KB
testcase_36 AC 625 ms
113,312 KB
testcase_37 AC 602 ms
113,312 KB
testcase_38 AC 596 ms
113,312 KB
testcase_39 AC 597 ms
113,312 KB
testcase_40 AC 512 ms
107,684 KB
testcase_41 AC 387 ms
113,296 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