Submission #2691517


Source Code Expand

from collections import defaultdict

n = int(input())
reds = [tuple(int(x) for x in input().split())for _ in range(n)]
blues = [tuple(int(x) for x in input().split())for _ in range(n)]

blue_dict = defaultdict(list)
for c, d in blues:
    for a, b in reds:
        if a < c and b < d:
            blue_dict[c, d].append((a, b))
for val in blue_dict.values():
    val.sort(key=lambda x:-x[1])

red_dict = {}
for blue, red_list in sorted(blue_dict.items(), key=lambda x:x[0][0]):
    for red in red_list:
        if red in red_dict:
            continue
        red_dict[red] = blue
        break

print(len(red_dict))

Submission Info

Submission Time
Task C - 2D Plane 2N Points
User zehnpaard
Language Python (3.4.3)
Score 400
Code Size 638 Byte
Status AC
Exec Time 27 ms
Memory 3564 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 5
AC × 17
Set Name Test Cases
Sample example_0, example_1, example_2, example_3, example_4
All example_0, example_1, example_2, example_3, example_4, line_0, line_1, line_2, line_3, maxrand_0, maxrand_1, maxrand_2, maxrand_3, maxrand_4, rand_0, rand_1, rand_2
Case Name Status Exec Time Memory
example_0 AC 23 ms 3316 KB
example_1 AC 23 ms 3316 KB
example_2 AC 23 ms 3316 KB
example_3 AC 23 ms 3316 KB
example_4 AC 23 ms 3316 KB
line_0 AC 24 ms 3436 KB
line_1 AC 24 ms 3316 KB
line_2 AC 24 ms 3316 KB
line_3 AC 23 ms 3316 KB
maxrand_0 AC 26 ms 3436 KB
maxrand_1 AC 26 ms 3564 KB
maxrand_2 AC 26 ms 3436 KB
maxrand_3 AC 27 ms 3564 KB
maxrand_4 AC 26 ms 3436 KB
rand_0 AC 26 ms 3564 KB
rand_1 AC 24 ms 3316 KB
rand_2 AC 25 ms 3436 KB