野鸡NOI.AC模拟赛【2019.10.26】
生活随笔
收集整理的這篇文章主要介紹了
野鸡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】的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: NOI.AC-保镖【贪心,对顶堆】
- 下一篇: 诺基亚 G42 5G 手机已开始测试安卓