前言
er…竟然卡读入输出还不给快读qwq
成绩
有些dalao被老师拉去USACO了,所以没有
HJW应该去jzoj做题了
R a n k Rank Rank | P e r s o n Person Person | S c o r e Score Score | A A A | B B B | C C C |
---|---|---|---|---|---|
1 1 1 | 2017 m y s e l f 2017myself 2017myself | 240 240 240 | 70 70 70 | 100 100 100 | 70 70 70 |
2 2 2 | 2017 z y c 2017zyc 2017zyc | 190 190 190 | 40 40 40 | 100 100 100 | 50 50 50 |
3 3 3 | 2017 l r z 2017lrz 2017lrz | 190 190 190 | 60 60 60 | 30 30 30 | 100 100 100 |
4 4 4 | 2017 x x y 2017xxy 2017xxy | 180 180 180 | 10 10 10 | 100 100 100 | 70 70 70 |
5 5 5 | 2017 x j q 2017xjq 2017xjq | 140 140 140 | 10 10 10 | 100 100 100 | 30 30 30 |
6 6 6 | 2015 z y f 2015zyf 2015zyf | 115 115 115 | 10 10 10 | 55 55 55 | 50 50 50 |
7 7 7 | 2015 y j y 2015yjy 2015yjy | 100 100 100 | 60 60 60 | 0 0 0 | 40 40 40 |
8 8 8 | 2017 h j q 2017hjq 2017hjq | 95 95 95 | 0 0 0 | 25 25 25 | 70 70 70 |
9 9 9 | 2017 l w 2017lw 2017lw | 90 90 90 | 0 0 0 | 80 80 80 | 10 10 10 |
10 10 10 | 2017 h z b 2017hzb 2017hzb | 90 90 90 | 10 10 10 | 30 30 30 | 50 50 50 |
正题
T 1 : n s s l 1209 − T1:nssl1209- T1:nssl1209−奇怪的队列【贪心 , , ,权值线段树】
博客链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/83213287
T 2 : n s s l 1210 − T2:nssl1210- T2:nssl1210−质数【素数筛】
博客链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/83213039
T 3 : n s s l 1211 − T3:nssl1211- T3:nssl1211−好文章【字符串 h a s h , m a p hash,map hash,map】
博客链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/83213085
s o m e o f c o d e some\ of\ code some of code
T1 70分code
#include<cstdio>
//#include<set>
#include<algorithm>
#define N 100010
using namespace std;
struct node{
int h,num,l,r;
}a[N];
int n;
bool cmp(node x,node y)
{
return x.h>y.h;
}
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
scanf("%d%d",&a[i].h,&a[i].num);
sort(a+1,a+1+n,cmp);
for(int i=1;i<=n;i++)
if(a[i].num>=i){
printf("impossible");
return 0;
}
a[0].r=n+1;
a[n+1].l=0;
//a[0].h=a[n+1].h=2147483647;
for(int i=1;i<=n;i++)
{
int now;
if(a[i].num>=i/2)
{
now=n+1;
for(int j=1;j<=a[i].num;j++)
now=a[now].l;
}
else
{
now=0;
for(int j=0;j<=a[i].num;j++)
now=a[now].r;
}
a[a[now].l].r=i;
a[i].l=a[now].l;
a[now].l=i;
a[i].r=now;
}
int now=0;
for(int i=1;i<=n;i++)
{
now=a[now].r;
printf("%d ",a[now].h);
}
}
T3 70分code
#include<cstdio>
#include<algorithm>
#include<map>
#define ull unsigned long long
#define p 13331
#define p2 13127
#define N 200010
using namespace std;
int n,m,ans;
ull pow[N],h[N],h2[N],pow2[N];
char s[N];
map<pair<ull,ull>,bool> ok;
ull ask(int l,int r)
{
return h[r]-h[l-1]*pow[r-l+1];
}
ull ask2(int l,int r)
{
return h2[r]-h2[l-1]*pow2[r-l+1];
}
int main()
{
scanf("%d%d",&n,&m);
scanf("%s",s+1);
pow[0]=pow2[0]=1;
for(int i=1;i<=n;i++)
{
pow[i]=pow[i-1]*p;
pow2[i]=pow2[i-1]*p2;
h[i]=h[i-1]*p+s[i]-'a'+1;
h2[i]=h2[i-1]*p2+s[i]-'a'+1;
}
for(int i=m;i<=n;i++)
{
ull k,k2;
if(!ok[make_pair(k=ask(i-m+1,i),k2=ask2(i-m+1,i))])
{
ok[make_pair(k,k2)]=true;
ans++;
}
}
printf("%d",ans);
}
尾声
没了