前言
截止至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);
}