Submission #67952252


Source Code Expand

t = int(input())

ans = []
for _ in range(t):
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))

    a.sort(reverse=True)
    b.sort()
    k = 0
    de = 0
    for i in range(n):
        if b[i] + a[k] >= m:
            de += 1
            k += 1
    
    ans.append(sum(a) + sum(b) - m * de)

for w in ans:
    print(w)

Submission Info

Submission Time
Task D - Match, Mod, Minimize 2
User permut
Language Python (CPython 3.11.4)
Score 400
Code Size 409 Byte
Status AC
Exec Time 519 ms
Memory 56424 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 1
AC × 30
Set Name Test Cases
Sample 00_sample_00.txt
All 00_sample_00.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 02_random_15.txt, 02_random_16.txt, 02_random_17.txt, 02_random_18.txt, 02_random_19.txt, 02_random_20.txt, 02_random_21.txt, 02_random_22.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 9 ms 8556 KiB
01_handmade_00.txt AC 266 ms 56424 KiB
01_handmade_01.txt AC 124 ms 55720 KiB
01_handmade_02.txt AC 139 ms 54396 KiB
01_handmade_03.txt AC 272 ms 54300 KiB
01_handmade_04.txt AC 9 ms 8524 KiB
01_handmade_05.txt AC 405 ms 10300 KiB
02_random_00.txt AC 267 ms 54144 KiB
02_random_01.txt AC 267 ms 54268 KiB
02_random_02.txt AC 285 ms 54296 KiB
02_random_03.txt AC 278 ms 54336 KiB
02_random_04.txt AC 169 ms 9180 KiB
02_random_05.txt AC 169 ms 9196 KiB
02_random_06.txt AC 169 ms 9048 KiB
02_random_07.txt AC 167 ms 9180 KiB
02_random_08.txt AC 169 ms 9140 KiB
02_random_09.txt AC 170 ms 9184 KiB
02_random_10.txt AC 182 ms 11396 KiB
02_random_11.txt AC 187 ms 10992 KiB
02_random_12.txt AC 186 ms 11392 KiB
02_random_13.txt AC 187 ms 11060 KiB
02_random_14.txt AC 181 ms 10996 KiB
02_random_15.txt AC 183 ms 11144 KiB
02_random_16.txt AC 519 ms 12760 KiB
02_random_17.txt AC 319 ms 10444 KiB
02_random_18.txt AC 309 ms 10564 KiB
02_random_19.txt AC 305 ms 10632 KiB
02_random_20.txt AC 312 ms 10628 KiB
02_random_21.txt AC 308 ms 10572 KiB
02_random_22.txt AC 310 ms 10556 KiB