Submission #23785019
Source Code Expand
N = int(input())
kukan = []
for i in range(N):
t, l, r = list(map(int, input().split()))
kukan.append({"t": t, "l": l, "r": r})
kukan = sorted(kukan, key=lambda x:x['l'])
ans = 0
for i in range(N-1):
for j in range(i+1, N):
k1 = kukan[i]
k2 = kukan[j]
if k1['t'] == 1 and (k2['t'] == 1 or k2['t'] == 2):
if k1['l'] <= k2['l'] and k2['l'] <= k1['r']:
ans += 1
if k1['t'] == 1 and (k2['t'] == 3 or k2['t'] == 4):
if k1['l'] <= k2['l'] and k2['l'] < k1['r']:
ans += 1
if k1['t'] == 2 and (k2['t'] == 1 or k2['t'] == 2):
if k1['l'] <= k2['l'] and k2['l'] < k1['r']:
ans += 1
if k1['t'] == 2 and (k2['t'] == 3 or k2['t'] == 4):
if k1['l'] <= k2['l'] and k2['l'] < k1['r']:
ans += 1
if k1['t'] == 3 and (k2['t'] == 1 or k2['t'] == 2):
if k1['l'] <= k2['l'] and k2['l'] <= k1['r']:
ans += 1
if k1['t'] == 3 and (k2['t'] == 3 or k2['t'] == 4):
if k1['l'] <= k2['l'] and k2['l'] < k1['r']:
ans += 1
if k1['t'] == 4 and (k2['t'] == 1 or k2['t'] == 2):
if k1['l'] <= k2['l'] and k2['l'] < k1['r']:
ans += 1
if k1['t'] == 4 and (k2['t'] == 3 or k2['t'] == 4):
if k1['l'] <= k2['l'] and k2['l'] < k1['r']:
ans += 1
print(ans)
Submission Info
| Submission Time | |
|---|---|
| Task | C - Many Segments |
| User | Tommy3 |
| Language | Python (3.8.2) |
| Score | 300 |
| Code Size | 1331 Byte |
| Status | AC |
| Exec Time | 1640 ms |
| Memory | 9608 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example0.txt, example1.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, example0.txt, example1.txt, special_01.txt, special_02.txt, special_03.txt, special_04.txt, special_05.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 000.txt | AC | 65 ms | 9144 KiB |
| 001.txt | AC | 1164 ms | 9248 KiB |
| 002.txt | AC | 751 ms | 9348 KiB |
| 003.txt | AC | 1454 ms | 9404 KiB |
| 004.txt | AC | 1466 ms | 9404 KiB |
| 005.txt | AC | 1627 ms | 9408 KiB |
| 006.txt | AC | 1578 ms | 9404 KiB |
| 007.txt | AC | 1561 ms | 9592 KiB |
| 008.txt | AC | 1585 ms | 9408 KiB |
| 009.txt | AC | 1461 ms | 9584 KiB |
| 010.txt | AC | 1473 ms | 9396 KiB |
| 011.txt | AC | 1458 ms | 9516 KiB |
| 012.txt | AC | 1527 ms | 9608 KiB |
| 013.txt | AC | 1570 ms | 9392 KiB |
| 014.txt | AC | 1548 ms | 9460 KiB |
| 015.txt | AC | 1498 ms | 9596 KiB |
| 016.txt | AC | 1483 ms | 9476 KiB |
| 017.txt | AC | 1461 ms | 9444 KiB |
| example0.txt | AC | 24 ms | 9244 KiB |
| example1.txt | AC | 21 ms | 9216 KiB |
| special_01.txt | AC | 17 ms | 9040 KiB |
| special_02.txt | AC | 28 ms | 9240 KiB |
| special_03.txt | AC | 1366 ms | 9604 KiB |
| special_04.txt | AC | 1640 ms | 9388 KiB |
| special_05.txt | AC | 1426 ms | 9572 KiB |