前言
呆学校呆4天依旧不想复习期中,期中考凉透了。
成绩
RankRankRank | PersonPersonPerson | ScoreScoreScore | AAA | BBB | CCC |
---|---|---|---|---|---|
111 | 2014lyk2014lyk2014lyk | 200200200 | 100100100 | 707070 | 303030 |
222 | 2017wyc2017wyc2017wyc | 180180180 | 100100100 | 808080 | 000 |
333 | 2017xjq2017xjq2017xjq | 170170170 | 100100100 | 707070 | 000 |
444 | 2014lxf2014lxf2014lxf | 160160160 | 100100100 | 606060 | 000 |
555 | 2017lrz2017lrz2017lrz | 130130130 | 303030 | 100100100 | 000 |
555 | 2013yhl2013yhl2013yhl | 130130130 | 100100100 | 303030 | 000 |
555 | 2015zyf2015zyf2015zyf | 130130130 | 100100100 | 303030 | 000 |
888 | 2014lxh2014lxh2014lxh | 120120120 | 100100100 | 202020 | 000 |
999 | 2017hzb2017hzb2017hzb | 110110110 | 303030 | 808080 | 000 |
101010 | 2014lx2014lx2014lx | 100100100 | 100100100 | 000 | 000 |
101010 | 2015gjh2015gjh2015gjh | 100100100 | 100100100 | 000 | 000 |
101010 | 2014wwt2014wwt2014wwt | 100100100 | 100100100 | 000 | 000 |
正题
T1:nssl1268−T1:nssl1268-T1:nssl1268−可见点数【数论,,,欧拉】
和仪仗队一样,就直接放仪仗队了
博客链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/81071889
T2:nssl1269−T2:nssl1269-T2:nssl1269−射击【贪心,,,堆】
博客链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/83618568
T3:nssl1270−T3:nssl1270-T3:nssl1270−创世纪【树形dp,dp,dp,基环树】
博客链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/83618655
someofcodesome\ of\ codesome of code
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>
#define N 1000010
using namespace std;
struct node{int to,next;
}a[N];
int n,x,ans,tot,cnt,cr[N],f[N][2],dp[N][2];
int ls[N];
bool v[N],c[N],ic[N];
void addl(int x,int y)
{a[++tot].to=y;a[tot].next=ls[x];ls[x]=tot;
}
void tree_dp(int x)
{f[x][1]=2147483647;bool flag=true;for(int i=ls[x];i;i=a[i].next){int y=a[i].to;if(ic[y]) continue;tree_dp(y);flag=false;f[x][0]+=max(f[y][1],f[y][0]);f[x][1]=min(f[x][1],f[y][1]-f[y][0]);}if(flag) f[x][1]=0;f[x][1]=f[x][0]-max(f[x][1],0)+1;
}
void check()
{for(int i=1;i<=cnt;i++)tree_dp(cr[i]);dp[0][0]=dp[0][1]=0;for(int i=1;i<=cnt;i++){dp[i][0]=max(dp[i-1][1],dp[i-1][0])+f[cr[i]][0];dp[i][1]=dp[i-1][0]+f[cr[i]][1];}int maxs=dp[cnt][0];dp[1][0]=f[cr[1]][0];dp[1][1]=0;for(int i=2;i<=cnt;i++){dp[i][0]=max(dp[i-1][1],dp[i-1][0])+f[cr[i]][0];dp[i][1]=dp[i-1][0]+f[cr[i]][1];}maxs=max(maxs,max(dp[cnt][0],dp[cnt][1]));ans+=maxs;
}
bool check_c(int x)
{v[x]=true;c[x]=true;for(int i=ls[x];i;i=a[i].next){int y=a[i].to;if(c[y]||check_c(y)) {ic[x]=true;cr[++cnt]=x;return true;}}return false;
}
int main()
{scanf("%d",&n);for(int i=1;i<=n;i++){scanf("%d",&x);addl(x,i);}for(int i=1;i<=n;i++){if(!v[i]){cnt=0;memset(c,0,sizeof(c));memset(ic,0,sizeof(ic));if(check_c(i))check();}}printf("%d",ans);
}
尾声
没了