36pts,re#5~#11,有提交记录,悬赏1关注

P1052 [NOIP2005 提高组] 过河

蹲蹲
by HugeSB @ 2023-06-05 19:01:58


@[Heart_Of_Iron_4](/user/169594) 笑死,这不大林子照片吗~~我以前也用过~~ >用户名或头像不和谐或冒充洛谷官方、管理员或其他著名人物
by 残阳如血 @ 2023-06-05 19:38:06


你也是钢(铁雄心)丝吗?
by 残阳如血 @ 2023-06-05 19:39:06


@[Heart_Of_Iron_4](/user/169594) bool 数组要1e9 https://www.luogu.com.cn/record/112236615 改完逝这样,还是36,但原因逝你复杂度不对,会TLE 改完是这样 ```cpp #include<bits/stdc++.h> #define int long long using namespace std; //char buf[1<<18],*p1=buf,*p2=buf; //#define getchar() (p1==p2&&(p1=buf,p2=p1+fread(buf,1,1<<18,stdin),p1==p2)?EOF:*p1++) inline int read(){ int x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9'){ if(ch=='-') f=-1; ch=getchar(); } while(ch>='0'&&ch<='9'){ x=x*10+ch-'0'; ch=getchar(); } return x*f; } inline void write(int x){ if(x<0){ putchar('-'); x=-x; } if(x>9) write(x/10); putchar(x%10+'0'); } map<int,int>a,b,c; int d[1000001]; signed main(){ // freopen(".in","r",stdin); // freopen(".out","w",stdout); int l=read(),s=read(),t=read(),m=read(),gd=s*t/__gcd(s,t); for(int i=1;i<=m;++i) d[i]=read(); sort(d+1,d+1+m); int t1,t2,t3; for(int i=1;i<=m;++i){ t2=d[i]; t3=t2; if(t1-t2>gd) t2=t1+gd; b[t2]=1; t1=t2; } l=t2+(l-t3); for(int i=s;i<=l;++i){ if(!a[i]) a[i]=b[i]; for(int j=s;j<=t;++j){ if(!c[i+j]) a[i+j]=a[i]+b[i+j],c[i+j]=1; else a[i+j]=min(a[i+j],a[i]+b[i+j]); } } int minn=INT_MAX; for(int i=l;i<=l+t;++i) if(c[i]) minn=min(a[i],minn); printf("%lld",minn); return 0; } ```
by chang_an_1029 @ 2023-06-07 21:50:32


@[chang_an_1029](/user/725327) 谢谢
by Heart_Of_Iron_4 @ 2023-06-07 22:08:53


|