avatar
l*a
1
deck of cards
put them randomly on the table.
two cards can only overlap with rectangle area.(cards must be Vertical/
horizontal to the edge of the table)
find the total area covered by those cards
avatar
v*a
2
Given, cards with (X_S1, X_E1, Y_S1, Y_E1)
1) Discretization on all points O(N)
O(N)
2) Sort by X
O(N)
3) Cut into pieces using sorted X.
O(N)
4) Count each piece separately.
O(N)
5) Sum up all
Total O(N)
avatar
e*l
3
area(Table) - sum_i (area(Card i)) + sum_{i,j>i} Overlap(Card i, Card j)
avatar
C*h
4
2楼对,3楼错。

【在 l*****a 的大作中提到】
: deck of cards
: put them randomly on the table.
: two cards can only overlap with rectangle area.(cards must be Vertical/
: horizontal to the edge of the table)
: find the total area covered by those cards

avatar
b*e
5
O(NlgN)
avatar
m*s
6
segment tree, O(nlogn)

【在 l*****a 的大作中提到】
: deck of cards
: put them randomly on the table.
: two cards can only overlap with rectangle area.(cards must be Vertical/
: horizontal to the edge of the table)
: find the total area covered by those cards

avatar
H*e
7
没看懂。什么叫discretization on all points?

【在 v***a 的大作中提到】
: Given, cards with (X_S1, X_E1, Y_S1, Y_E1)
: 1) Discretization on all points O(N)
: O(N)
: 2) Sort by X
: O(N)
: 3) Cut into pieces using sorted X.
: O(N)
: 4) Count each piece separately.
: O(N)
: 5) Sum up all

avatar
a*m
8
不可能O(n)吧。

【在 C*********h 的大作中提到】
: 2楼对,3楼错。
avatar
H*e
9
这题谁能给个确切的解法么?似乎是经典题?

【在 l*****a 的大作中提到】
: deck of cards
: put them randomly on the table.
: two cards can only overlap with rectangle area.(cards must be Vertical/
: horizontal to the edge of the table)
: find the total area covered by those cards

avatar
z*t
10
既然有sort,怎么能是O(N)?

【在 v***a 的大作中提到】
: Given, cards with (X_S1, X_E1, Y_S1, Y_E1)
: 1) Discretization on all points O(N)
: O(N)
: 2) Sort by X
: O(N)
: 3) Cut into pieces using sorted X.
: O(N)
: 4) Count each piece separately.
: O(N)
: 5) Sum up all

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。