前言
有一个暴力写挂了QVQQVQQVQ
成绩
RankRankRank | PersonPersonPerson | ScoreScoreScore | AAA | BBB | CCC |
---|---|---|---|---|---|
111111 | (J−3)LRZ(J-3)LRZ(J−3)LRZ | 140140140 | 100100100 | 303030 | 101010 |
191919 | (J−3)WYC(J-3)WYC(J−3)WYC | 120120120 | 100100100 | 101010 | 101010 |
262626 | (J−3)HZB(J-3)HZB(J−3)HZB | 100100100 | 606060 | 303030 | 101010 |
262626 | (J−3)XJQ(J-3)XJQ(J−3)XJQ | 100100100 | 100100100 | 000 | 000 |
393939 | (H−1)QYH(H-1)QYH(H−1)QYH | 909090 | 202020 | 707070 | 000 |
393939 | (J−3)XXY(J-3)XXY(J−3)XXY | 909090 | 606060 | 303030 | 000 |
474747 | (J−3)LW(J-3)LW(J−3)LW | 707070 | 404040 | 303030 | 000 |
606060 | (H−2)HJW(H-2)HJW(H−2)HJW | 404040 | 404040 | 000 | 000 |
606060 | (H−2)LZX(H-2)LZX(H−2)LZX | 404040 | 404040 | 000 | 000 |
606060 | (H−2)TRX(H-2)TRX(H−2)TRX | 404040 | 404040 | 000 | 000 |
606060 | (J−3)HJQ(J-3)HJQ(J−3)HJQ | 404040 | 404040 | 000 | 000 |
正题
T1:jzoj6309−T1:jzoj6309-T1:jzoj6309−完全背包【贪心,,,背包】
链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/99707673
T2:jzoj6308−T2:jzoj6308-T2:jzoj6308−中间值【分治】
链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/99707694
T3:jzoj6306−SequenceT3:jzoj6306-SequenceT3:jzoj6306−Sequence【线性筛,,,积性函数,,,数论】
链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/99707865
总结
不想写,反正就是T1T1T1写了贪心T2T2T2写了暴力结果写挂了T3T3T3写了暴力10pts10pts10pts
SomeofcodeSome\ of\ codeSome of code
T210ptscodeT2\ 10pts\ codeT2 10pts code
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=510000;
int n,m,a[N],b[N];
int calc(int *a,int w,int l,int r)
{return (lower_bound(a+l,a+1+r,w)-a)-l;}
int solve(int *a,int *b,int l1,int r1,int l2,int r2)
{int l=l1,r=r1,k=(r1-l1+r2-l2+3)/2;while(l<=r){int mId=(l+r)/2;if(mId-l1+1+calc(b,a[mId],l2,r2)<k) l=mId+1;else r=mId-1;}if(l>r1) return 0;return a[l]*((l-l1+1+calc(b,a[l],l2,r2))==k);
}
int main()
{freopen("median.in","r",stdin);freopen("median.out","w",stdout);scanf("%d%d",&n,&m);for(int i=1;i<=n;i++)scanf("%d",&a[i]);for(int i=1;i<=n;i++)scanf("%d",&b[i]);while(m--){int opt,x,y,l,r;scanf("%d%d%d%d",&opt,&x,&y,&l);if(opt==1){if(l) a[x]=y;else b[x]=y; }else{scanf("%d",&r);printf("%d\n",solve(a,b,x,y,l,r)|solve(b,a,l,r,x,y));}}
}
T310ptscodeT3\ 10pts\ codeT3 10pts code
#include<cstdio>
#include<cstring>
#include<algorithm>
const int XJQ=998244353;
int n,m,B,prime[5100000],cnt,ans;
bool v[21000000];
using namespace std;
int power(int x,int b)
{int ans=1;while(b){if(b&1) ans=ans*x%XJQ;x=x*x%XJQ;b>>=1;}return ans;
}
void dfs(int dep,int sum,int e)
{int i=1,k=0;if(dep>cnt){(ans+=power(sum,n))%=XJQ;return;}while(e*i<=m)dfs(dep+1,sum*(k+1),e*i),k++,i*=prime[dep];
}
void solve(int x,int gcd)
{if(x==n){(ans+=gcd)%=XJQ;return;}for(int i=1;i<=cnt;i++)solve(x+1,__gcd(gcd,prime[i]));
}
int main()
{freopen("sequence.in","r",stdin);freopen("sequence.out","w",stdout);scanf("%d%d%d",&n,&m,&B);if(B==1){v[1]=1;for(int i=2;i<=m;i++){if(!v[i]) prime[++cnt]=i;for(int j=1;j<=cnt&&i*prime[j]<=m;j++){v[prime[j]*i]=1;if(!(i%prime[j])) break;}}memset(v,0,sizeof(v));dfs(1,1,1);printf("%d",ans);}else{do{cnt=0;for(int i=1;i*i<=m;i++){if(!(m%i)) prime[++cnt]=i;if(!(m%i)&&m/i!=i)prime[++cnt]=m/i;}solve(0,B);}while(m--);printf("%d",ans);}
}
话说
今天牛客Rank1Rank1Rank1了!!!!!!!!!(然而是一堆原题的水题赛)