Submission #66487417


Source Code Expand

for _ in range(int(input())):
    n = int(input())
    l = [0] * n
    r = [0] * n
    for i in range(n):
        l[i], r[i] = map(int, input().split())
    ans = [-1] * n
    for p in reversed(range(n)):
        for i in reversed(range(n)):
            if ans[i] != -1:
                continue
            ok = True
            for j in range(n):
                ok &= ans[j] != -1 or not l[j] < l[i] < r[i] < r[j]
            if not ok:
                continue
            ans[i] = p + 1
            break
    print(*ans)

Submission Info

Submission Time
Task C - Movie Theater
User sounansya
Language Python (PyPy 3.10-v7.3.12)
Score 700
Code Size 543 Byte
Status AC
Exec Time 394 ms
Memory 83404 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 700 / 700
Status
AC × 1
AC × 27
Set Name Test Cases
Sample 00_sample_00.txt
All 00_sample_00.txt, 01_small_00.txt, 01_small_01.txt, 01_small_02.txt, 02_handmade_00.txt, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt, 02_handmade_04.txt, 03_random_00.txt, 03_random_01.txt, 03_random_02.txt, 03_random_03.txt, 03_random_04.txt, 03_random_05.txt, 03_random_06.txt, 03_random_07.txt, 03_random_08.txt, 03_random_09.txt, 03_random_10.txt, 03_random_11.txt, 03_random_12.txt, 03_random_13.txt, 03_random_14.txt, 03_random_15.txt, 03_random_16.txt, 03_random_17.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 59 ms 76508 KiB
01_small_00.txt AC 73 ms 80768 KiB
01_small_01.txt AC 59 ms 76428 KiB
01_small_02.txt AC 64 ms 76376 KiB
02_handmade_00.txt AC 71 ms 81920 KiB
02_handmade_01.txt AC 74 ms 81852 KiB
02_handmade_02.txt AC 394 ms 81828 KiB
02_handmade_03.txt AC 71 ms 82044 KiB
02_handmade_04.txt AC 206 ms 82672 KiB
03_random_00.txt AC 76 ms 81840 KiB
03_random_01.txt AC 75 ms 82008 KiB
03_random_02.txt AC 78 ms 82092 KiB
03_random_03.txt AC 77 ms 81852 KiB
03_random_04.txt AC 89 ms 82668 KiB
03_random_05.txt AC 90 ms 82484 KiB
03_random_06.txt AC 124 ms 83068 KiB
03_random_07.txt AC 111 ms 82940 KiB
03_random_08.txt AC 296 ms 82388 KiB
03_random_09.txt AC 294 ms 83028 KiB
03_random_10.txt AC 258 ms 83192 KiB
03_random_11.txt AC 314 ms 83404 KiB
03_random_12.txt AC 283 ms 82904 KiB
03_random_13.txt AC 270 ms 82128 KiB
03_random_14.txt AC 274 ms 82300 KiB
03_random_15.txt AC 265 ms 82884 KiB
03_random_16.txt AC 272 ms 83072 KiB
03_random_17.txt AC 303 ms 83024 KiB