ssl提高組週四備考賽【2018.11.1】
阿新 • • 發佈:2018-11-05
前言
呆學校呆4天依舊不想複習期中,期中考涼透了。
成績
正題
可見點數【數論 尤拉】
和儀仗隊一樣,就直接放儀仗隊了
部落格連結:
https://blog.csdn.net/Mr_wuyongcong/article/details/81071889
射擊【貪心 堆】
部落格連結:
https://blog.csdn.net/Mr_wuyongcong/article/details/83618568
創世紀【樹形 基環樹】
部落格連結:
https://blog.csdn.net/Mr_wuyongcong/article/details/83618655
T2 80分code
#include<cstdio>
#include<queue>
#include<algorithm>
#define ll long long
#define N 200100
using namespace std;
struct node{
ll t,w;
}a[N];
ll n,last,ans;
priority_queue<ll> q;
bool cmp(node x,node y)
{return x.t==y.t?x.w>y.w:x.t>y.t;}
int main()
{
scanf("%lld",&n);
for(ll i=1;i<=n;i++)
scanf("%lld%lld",&a[i].t,&a[i].w);
sort(a+1,a+1+n,cmp);
for(ll i=1;i<=n;i++)
{
q.push(a[i].w);
for(ll j=a[i+1].t;j<a[i].t&&!q.empty();j++)
{
ans+=q.top();
q.pop();
}
}
printf("%lld",ans);
}
T3 0分code
#include<cstdio>
#include<algorithm>
#include<cstring><