日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Axis-Parallel Rectangle

發(fā)布時間:2025/6/15 编程问答 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Axis-Parallel Rectangle 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

D - Axis-Parallel Rectangle


Time limit?: 2sec /?Memory limit?: 256MB

Score :?400?points

Problem Statement

We have?N?points in a two-dimensional plane.
The coordinates of the?i-th point?(1≤i≤N)?are?(xi,yi).
Let us consider a rectangle whose sides are parallel to the coordinate axes that contains?K?or more of the?N?points in its interior.
Here, points on the sides of the rectangle are considered to be in the interior.
Find the minimum possible area of such a rectangle.

Constraints

  • 2≤K≤N≤50
  • ?109≤xi,yi≤109(1≤i≤N)
  • xi≠xj(1≤i<j≤N)
  • yi≠yj(1≤i<j≤N)
  • All input values are integers. (Added at 21:50 JST)

Input

Input is given from Standard Input in the following format: N K x1 y1 : xN yN

Output

Print the minimum possible area of a rectangle that satisfies the condition.

Sample Input 1

Copy 4 4 1 4 3 3 6 2 8 1

Sample Output 1

Copy 21 One rectangle that satisfies the condition with the minimum possible area has the following vertices:?(1,1),?(8,1),?(1,4)?and?(8,4).
Its area is?(8?1)×(4?1)=21.

Sample Input 2

Copy 4 2 0 0 1 1 2 2 3 3

Sample Output 2

Copy 1

Sample Input 3

Copy 4 3 -1000000000 -1000000000 1000000000 1000000000 -999999999 999999999 999999999 -999999999 Sample Output 3 3999999996000000001 Watch out for integer overflows. // N 個點,選出一個最小的矩形,包括至少 k 個點,求這最小的矩形的面積 // 枚舉,瘋狂枚舉就行 1 #include <bits/stdc++.h> 2 using namespace std; 3 #define MOD 998244353 4 #define INF 0x3f3f3f3f3f3f3f3f 5 #define LL long long 6 #define MX 55 7 struct Node 8 { 9 LL x, y; 10 bool operator < (const Node &b)const{ 11 return x<b.x; 12 } 13 }pt[MX]; 14 15 int k, n; 16 17 int main() 18 { 19 scanf("%d%d",&n,&k); 20 for (int i=1;i<=n;i++) 21 scanf("%lld%lld",&pt[i].x, &pt[i].y); 22 sort(pt+1,pt+1+n); 23 LL area = INF; 24 for (int i=1;i<=n;i++) 25 { 26 for (int j=i+1;j<=n;j++) 27 { 28 LL miny = min(pt[i].y, pt[j].y); 29 LL maxy = max(pt[i].y, pt[j].y); 30 for (int q=1;q<=n;q++) 31 { 32 if (pt[q].y>maxy||pt[q].y<miny) continue; 33 int tot = 0; 34 for (int z=q;z<=n;z++) 35 { 36 if (pt[z].y>maxy||pt[z].y<miny) continue; 37 tot++; 38 if (tot>=k) 39 area = min(area, (maxy-miny)*(pt[z].x-pt[q].x)); 40 } 41 } 42 } 43 } 44 printf("%lld\n",area); 45 return 0; 46 } View Code

?

轉(zhuǎn)載于:https://www.cnblogs.com/haoabcd2010/p/7673891.html

總結(jié)

以上是生活随笔為你收集整理的Axis-Parallel Rectangle的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 日本精品在线观看 | 成人手机在线视频 | av资源共享 | 成人午夜性视频 | 成人网视频 | 性开放耄耋老妇hd | 国产97自拍 | 国产精品2| 中文字幕伦理 | 操色网| 好吊一区二区三区 | 69激情网| 性色av一区二区三区红粉影视 | 免费看黄色aaaaaa 片 | 亚洲AV成人午夜无码精品久久 | 亚洲精品一区二区潘金莲 | 欧美激情一级 | 无码gogo大胆啪啪艺术 | 亚洲精品国产99 | 经典三级第一页 | 国产露脸无套对白在线播放 | 美国成人av | 日韩99| 精品国产黄色片 | 日日射av| 亚洲国产一二 | 国产第一页在线观看 | 中文字幕在线三区 | 日韩在线观看一区二区 | 国产精品久久影视 | 亚州中文字幕 | 一级片免费网站 | 超碰人人草 | 国产男男gay | 国产高清视频在线 | 亚洲第一视频在线 | 午夜精品一区二 | 欧美成年人视频在线观看 | a∨视频 | 91国自产精品中文字幕亚洲 | 亚洲成年人免费观看 | 亚洲国产精彩视频 | 91网在线观看 | 婷婷久久伊人 | 综合久久网| 男人和女人日批视频 | 精品久久久av | avt天堂网 | 国产精品国产三级国产aⅴ原创 | 黄色网久久 | 免费黄网站在线看 | 国产高清不卡av | 五十路六十路七十路熟婆 | 嫩草网站在线观看 | 欧美干干 | 可以在线看黄的网站 | 亚洲视频区 | 国产成人一区二区在线 | 黄色美女大片 | 亚洲欧洲自拍偷拍 | 大肉大捧一进一出好爽mba | 亚洲另类欧美日韩 | 三级黄色免费片 | 久久久香蕉 | 国产一级片播放 | 一级做a视频 | 免费网站成人 | 一级国产精品 | 国产一区二区免费电影 | 一区二区精| 欧美xxxxx高潮喷水麻豆 | 538国产视频 | 99久久精品免费看国产免费软件 | 国产一区二区综合 | 国产曰肥老太婆无遮挡 | 日韩视频精品 | 欧美伦理一区二区三区 | 风韵少妇性饥渴推油按摩视频 | 蜜臀av性久久久久蜜臀aⅴ四虎 | 爆操网站 | 亚洲国产欧美日韩在线 | 国产精品久久久99 | 深夜小视频在线观看 | 亚洲男人天堂视频 | 久久婷婷色 | 精品美女久久久 | 国产99久久久欧美黑人 | 精品少妇人妻AV无码专区在线 | 脱裤吧导航 | 日韩欧美视频免费在线观看 | 黑人添美女bbb添高潮了 | 荫道bbwbbb高潮潮喷 | 神马午夜一区 | 色五丁香 | 毛片官网 | 欧美乱码精品一区二区三区 | 欧美亚洲综合久久 | 国产丰满大乳奶水在线视频 | 亚洲免费精品 |