Love丶FFC's Blog
在某图形操作系统中,有 N 个窗口,每个窗口都是一个两边与坐标轴分别平行的矩形区域。窗口的边界上的点也属于该窗口。窗口之间有层次的区别,在多于一个窗口重叠的区域里,只会显示位于顶层的窗口里的内容。
当你点击屏幕上一个点的时候,你就选择了处于被点击位置的最顶层窗口,并且这个窗口就会被移到所有窗口的最顶层,而剩余的窗口的层次顺序不变。如果你点击的位置不属于任何窗口,则系统会忽略你这次点击。
现在我们希望你写一个程序模拟点击窗口的过程。
输入的第一行有两个正整数,即 N 和 M。(1 ≤ N ≤ 10,1 ≤ M ≤ 10)
接下来 N 行按照从最下层到最顶层的顺序给出 N 个窗口的位置。 每行包含四个非负整数 x1, y1, x2, y2,表示该窗口的一对顶点坐标分别为 (x1, y1) 和 (x2, y2)。保证 x1 < x2,y1 < y2 。
接下来 M 行每行包含两个非负整数 x, y,表示一次鼠标点击的坐标。
题目中涉及到的所有点和矩形的顶点的 x, y 坐标分别不超过 2559 和1439。
输出包括 M 行,每一行表示一次鼠标点击的结果。如果该次鼠标点击选择了一个窗口,则输出这个窗口的编号(窗口按照输入中的顺序从 1 编号到 N);如果没有,则输出"IGNORED"(不含双引号)。
3 4
0 0 4 4
1 1 5 5
2 2 6 6
1 1
0 0
4 4
0 5
2
1
1
IGNORED
第一次点击的位置同时属于第 1 和第 2 个窗口,但是由于第 2 个窗口在上面,它被选择并且被置于顶层。
第二次点击的位置只属于第 1 个窗口,因此该次点击选择了此窗口并将其置于顶层。现在的三个窗口的层次关系与初始状态恰好相反了。
第三次点击的位置同时属于三个窗口的范围,但是由于现在第 1 个窗口处于顶层,它被选择。
最后点击的 (0, 5) 不属于任何窗口。
1.首先存储各类数组,因为最初的数组已经按照大小层次排序输入,对每个点击坐标分别对数组从高到低进行判断。
2.如果点击成功,则保存该窗口此时的坐标,之后将所有窗口的层次重新交换,最后找出该窗口最初的位置即可
N, M = map(int, input().split()) # 输入窗口数和点击的次数 InitialWindow = [[0, 0, 0, 0]] * N # 最初的窗口坐标列表 Window = [[0, 0, 0, 0]] * N # 改变过程中的窗口坐标列表 Click = [[0, 0]] * M # 点击坐标列表 Top = 0 # 定义顶层窗口标号 for i in range(N): Window[i] = [int(n) for n in input().split()] # 将一行的输入赋给窗口坐标列表 InitialWindow[i] = Window[i] for i in range(M): Click[i] = [int(n) for n in input().split()] # 将一行的输入赋给点击坐标列表 Clicked = [0] * N # 定义层级关系列表 for i in range(M): Judge = False # 判断是否点击成功 for j in range(N - 1, -1, -1): if Click[i][0] >= Window[j][0] and Click[i][0] <= Window[j][2] and Click[i][1] >= Window[j][1] and Click[i][1] <= Window[j][3]: Judge = True Top = j break if Judge == True: # 存在点击成功的窗口 Topwindow = Window[Top] # 暂时存储顶层窗口 for k in range(Top, N - 1): Window[k] = Window[k + 1] # 依次进行窗口层次替换 Window[N - 1] = Topwindow # 覆盖顶层窗口 for l in range(N): # 找出该顶层窗口在最初的位置标号并输出 if Window[N - 1][0] == InitialWindow[l][0] and Window[N - 1][1] == InitialWindow[l][1] and Window[N - 1][ 2] == InitialWindow[l][2] and Window[N - 1][3] == InitialWindow[l][3]: print(l + 1) break else: # 不存在点击成功的窗口 print("IGNORED")
fruinly
real cialis no generic Mammographic Density Estimates
engarma
a prohibited substance is found to be present within the athlete s body tissue or fluids; or buy real cialis online
Preliaf
cialis generic name It said the bombardment of Sumter
Preliaf
Several studies have demonstrated a role for PVL in dermonecrosis cialis 5mg
Williamjotly
best online pharmacy
AlanLit
disulfiram tablets 500mg
IvyLit
zestoretic 10
JackLit
buy amoxil without prescription
IvyLit
lyrica 900 mg
lZFFZdbT
Our results validated that blocking mitochondrial translation reduces cytosolic translation and leads to a detection of reduced level of proteins in both N2 and CB4856 worms as a consequence D Amico et al viagra for covid
IvyLit
valtrex cream over the counter
AlanLit
phenergan generic
SueLit
tizanidine tablets india
JoeLit
augmentin 875 125 mg price
SueLit
clindamycin cream otc
JoeLit
how to purchase propecia
IvyLit
trazodone 100 tab
ZakLit
amoxicillin 5 mg
MaryLit
erectafil 20 for sale
JackLit
canadian metformin
Davidevelf
tamoxifen pill
SamLit
phenergan 25mg tablets price
IvyLit
triamterene hctz 37.5-25 mg
SueLit
nolvadex tablet
ZakLit
prazosin for nightmares
MaryLit
lioresal 10 mg
ZakLit
atarax 10 mg cost
Michaelsmopy
lioresal 25 mg
Elwoodexcix
phenergan pharmacy nz
DavisIgnip
where to buy tamoxifen uk
SamuelEcors
phenergan 10mg tablet
SamuelEcors
325443009 prednisolone
DarrylBox
atarax for itching
Michaelsmopy
atarax online
Elwoodexcix
prazosin hcl
MaryLit
generic atenolol 50 mg
SamuelEcors
atenolol 100 mg for sale
Williamjotly
atarax 100 mg
SamLit
atenolol metoprolol
EyeLit
azithromycin for sale australia
Richardatone
triamterene 37.5 25 mg
JoeLit
purchase nolvadex no prescription
SamuelEcors
canada drugstore pharmacy rx
MaryLit
online pharmacy without insurance
AshLit
zofran 0.5 mg
Williamjotly
lioresal baclofen
JosephKip
baclofen 20 mg
JoeLit
atarax prescription
IvyLit
canadian pharmacy cymbalta 60 mg
SamuelEcors
rx online pharmacy
IvyLit
nolvadex price in india online
DarrylBox
atarax 25 mg
DavisIgnip
nolvadex for men
Michaelsmopy
where to buy retin a cream
Michaelsmopy
online pharmacy
IvyLit
where to buy nolvadex online
JoeLit
cymbalta online
Michaelsmopy
cost of cymbalta 60 mg
Elwoodexcix
tadalafil capsules
Williamjotly
robaxin 750 mg price
SamuelEcors
buy tamoxifen
IvyLit
prazosin 5 mg
Michaelsmopy
canada pharmacy online legit
AshLit
cafergot tablets buy online
SamuelEcors
can you buy azithromycin without a prescription
SueLit
dexamethasone 6 tablet
SueLit
atarax 50 mg cost
SueLit
atarax 25 mg buy uk
Richardatone
online pharmacy australia paypal
AshLit
lyrica mexico
JackLit
levaquin
Davidevelf
prazosin tablet
MaryLit
atarax generic otc
ZakLit
zithromax 500mg online
SamuelEcors
prednisolone tablets 25mg
MaryLit
prednisolone 5mg tablets for sale
DarrylBox
best nolvadex
SueLit
triamterene/hctz 37.5-25 mg
Michaelsmopy
buying prednisoline tablets
AshLit
dipyridamole cost
SueLit
lipitor 20 mg canada price
JackLit
prazosin hcl 1mg cap
SueLit
baclofen uk online
Richardatone
lyrica price comparison
SamLit
buy phenergan online
DavisIgnip
plavix generic available
CurtisHed
albuterol price in usa
Michaelsmopy
can i order lisinopril online
DavisIgnip
buy accutane 20mg online
Richardatone
amoxicillin 400mg price
DarrylBox
lisinopril 5 mg tablet
DarrylBox
where to buy synthroid
Davidevelf
synthroid 88
SamuelEcors
plavix generic
SamLit
diclofenac pills usa
SamLit
buy diflucan online canada
JoeLit
plaquenil oct
AlanLit
lisinopril 20 mg uk
Elwoodexcix
augmentin 500 mg tablet price
MaryLit
accutane online canada
SamLit
my canadian pharmacy rx
MaryLit
buy plavix
SueLit
online med pharmacy
Elwoodexcix
strattera generic best price pharmacy
Elwoodexcix
retino 0.05 gel
JosephKip
buy cheap lisinopril 40 mg no prescription
Richardatone
how to get phenergan
Elwoodexcix
propranolol price canada
Davidevelf
diflucan tablet uk
SueLit
prednisone 60 mg
SamuelEcors
bactrim ds medication
DavisIgnip
strattera online generic
DavisIgnip
canadian pharmacy online accutane
Williamjotly
suhagra 100mg buy online india
DavisIgnip
purchase bactrim ds
EyeLit
clopidogrel 5mg
SueLit
diclofenac topical gel
Williamjotly
synthroid 137.5 mcg
SueLit
voltaren over the counter medicine
SamuelEcors
diflucan tablets price
AlanLit
lyrica pills for sale
AlanLit
diflucan 400mg without prescription
JosephKip
flomax 90 price
AshLit
how to get synthroid
Elwoodexcix
buy duflican
SueLit
bactrim australia
Michaelsmopy
cheap suhagra
AshLit
web pharmacy
ZakLit
albuterol prescription prices
Davidevelf
azithromycin cheapest price
JosephKip
flomax generic best price
MaryLit
can i buy flomax without a prescription
ZakLit
tizanidine 4mg
ZakLit
pharmacy india amoxil no prescription
ZakLit
combivent respimat package insert
DavisIgnip
diflucan 150 mg coupon