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

歡迎訪問 生活随笔!

生活随笔

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

编程问答

野鸡NOI.AC模拟赛【2019.10.26】

發布時間:2023/12/3 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 野鸡NOI.AC模拟赛【2019.10.26】 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

前言


截止至2019.10.2614:222019.10.26\ \ \ \ 14:222019.10.26????14:22


成績


正題


T1:NOI.AC?T1:NOI.AC-T1:NOI.AC?序列【堆】

https://blog.csdn.net/Mr_wuyongcong/article/details/102755906


T2:NOI.AC?T2:NOI.AC-T2:NOI.AC?積木【堆】

https://blog.csdn.net/Mr_wuyongcong/article/details/102755962


T3:NOI.AC?T3:NOI.AC-T3:NOI.AC?保鏢【貪心,,,對頂堆】

https://blog.csdn.net/Mr_wuyongcong/article/details/102756060


總結

T1T1T1比較簡單,直接見過就切了
T2T2T2開始就寫完了,但是不知道會TLETLETLE只有606060,后來發現會TTT就改了一下,然后就炸了。
T3T3T3還算簡單就過了。


someofcodesome\ of\ codesome?of?code

T260ptscodeT2\ 60pts\ codeT2?60pts?code

#include<cstdio> #include<cstring> #include<algorithm> #include<queue> using namespace std; struct node{int x,y; }last; bool operator<(const node &x,const node &y) {return x.x==y.x?x.y>y.y:x.x>y.x;} int n,ans; priority_queue<node> q; int main() {scanf("%d",&n);for(int i=1;i<=n;i++){int x,y;scanf("%d%d",&x,&y);q.push((node){x,y});}last.x=-1e9-1;while(!q.empty()){node p=q.top();ans++;q.pop();if(p.x==last.x&&p.y==last.y){ans--;continue;}if(p.x==last.x&&p.y==last.y+2)q.push((node){p.x+1,p.y-1});last=p;}printf("%d",ans); }

T20ptscodeT2\ 0pts\ codeT2?0pts?code

#include<cstdio> #include<cstring> #include<algorithm> #include<queue> #define ll long long using namespace std; struct node{ll x,y,len; }last; bool operator<(const node &x,const node &y) {if(x.x==y.x) return x.len==y.len?x.y>y.y:x.len<y.len;else return x.x>y.x; } ll n,ans; priority_queue<node> q; int main() {scanf("%lld",&n);for(ll i=1;i<=n;i++){ll x,y;scanf("%lld%lld",&x,&y);q.push((node){x,y,1});}last.x=-1e9-1;while(!q.empty()){node p=q.top();q.pop();if(p.x==last.x&&p.y<=last.y+last.len*2-2)continue;//printf("%lld : %lld->%lld\n",p.x,p.y,p.y+p.len*2-1);ans+=p.len;if(last.x==-1e9-1){last=p;continue;}if(p.x==last.x&&p.y==last.y+last.len*2){p=last;p.len++;}if(p.len>1&&(q.empty()||q.top().x!=p.x||q.top().y!=p.y+p.len*2))q.push((node){p.x+1,p.y+1,p.len-1});last=p;}printf("%lld",ans); }

總結

以上是生活随笔為你收集整理的野鸡NOI.AC模拟赛【2019.10.26】的全部內容,希望文章能夠幫你解決所遇到的問題。

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