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

歡迎訪問 生活随笔!

生活随笔

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

编程问答

CF1142C U2

發布時間:2025/4/16 编程问答 14 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CF1142C U2 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

題目鏈接:洛谷?codeforces


$y>x^2+bx+c$也就是$y-x^2>bx+c$

左邊是點,右邊是直線.

維護上凸包.

雖然這么簡單但就是做不出來。

1 #include<cstdio> 2 #include<algorithm> 3 #define Rint register int 4 using namespace std; 5 typedef long long LL; 6 const int N = 100003; 7 struct Point { 8 LL x, y; 9 inline Point(LL _x = 0, LL _y = 0): x(_x), y(_y){} 10 inline Point operator - (const Point &o) const {return Point(x - o.x, y - o.y);} 11 inline LL operator * (const Point &o) const {return x * o.y - y * o.x;} 12 inline bool operator < (const Point &o) const {return x < o.x || x == o.x && y > o.y;} 13 } p[N], q[N], stk[N]; 14 int n, m, top; 15 int main(){ 16 scanf("%d", &n); 17 for(Rint i = 1;i <= n;i ++){ 18 scanf("%I64d %I64d", &p[i].x, &p[i].y); 19 p[i].y -= p[i].x * p[i].x; 20 } 21 sort(p + 1, p + n + 1); 22 q[m = 1] = p[1]; 23 for(Rint i = 2;i <= n;i ++) if(p[i].x != p[i - 1].x) q[++ m] = p[i]; 24 for(Rint i = 1;i <= m;i ++){ 25 while(top > 1 && (stk[top] - stk[top - 1]) * (q[i] - stk[top - 1]) >= 0) -- top; 26 stk[++ top] = q[i]; 27 } 28 printf("%d\n", top - 1); 29 } // nantf tai qiang le! CF1142C

?

轉載于:https://www.cnblogs.com/AThousandMoons/p/10662648.html

總結

以上是生活随笔為你收集整理的CF1142C U2的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。