看不到你的代码
by Siyuan @ 2018-02-23 21:46:23
我全都加$\ register$优化的,一切正常啊
by Siyuan @ 2018-02-23 21:46:47
```cpp
#include<bits/stdc++.h>//无register
using namespace std;
int t1,t2,t3,t4;
int t[10005],s[10005],p[10005];
int f[1005];
int main()
{
int m;
scanf("%d:%d %d:%d %d",&t1,&t2,&t3,&t4,&m);
if(t2>t4)
{
t4-=60;
t3++;
}
int n=t4-t2+(t3-t1)*60;
int c,d,e;
for(c=1;c<=m;c++)
{
scanf("%d %d %d",&t[c],&s[c],&p[c]);
}
for(c=1;c<=m;c++)
{
if(p[c]==0)
{
for(d=t[c];d<=n;d++)
{
int tt=f[d-t[c]]+s[c];
if(f[d]<tt)
{
f[d]=tt;
}
}
continue;
}
for(d=0;d<p[c];d++)
{
for(e=n;e>=t[c];e--)
{
int tt=f[e-t[c]]+s[c];
if(f[e]<tt)
{
f[e]=tt;
}
}
}
}
// for(c=0;c<=n;c++)
// {
// printf("%d ",f[c]);
// }
// cout<<endl;
cout<<f[n]<<endl;
// printf("%d\n",clock());
return 0;
}
```
by wasa855 @ 2018-02-23 21:48:09
```cpp
#include<bits/stdc++.h>//有register
using namespace std;
int t1,t2,t3,t4;
int t[10005],s[10005],p[10005];
int f[1005];
int main()
{
int m;
memset(f,-1,sizeof(f));
scanf("%d:%d %d:%d %d",&t1,&t2,&t3,&t4,&m);
if(t2>t4)
{
t4-=60;
t3++;
}
int n=t4-t2+(t3-t1)*60;
register int c,d,e;
for(c=1;c<=m;c++)
{
scanf("%d %d %d",&t[c],&s[c],&p[c]);
}
for(c=1;c<=m;c++)
{
if(p[c]==0)
{
for(d=t[c];d<=n;d++)
{
int tt=f[d-t[c]]+s[c];
if(f[d]<tt)
{
f[d]=tt;
}
}
continue;
}
for(d=0;d<p[c];d++)
{
for(e=n;e>=t[c];e--)
{
int tt=f[e-t[c]]+s[c];
if(f[e]<tt)
{
f[e]=tt;
}
}
}
}
// for(c=0;c<=n;c++)
// {
// printf("%d ",f[c]);
// }
// cout<<endl;
cout<<f[n]<<endl;
// printf("%d\n",clock());
return 0;
}
```
by wasa855 @ 2018-02-23 21:48:43
是memset的锅==
你把第二份代码里的memset去掉就行了(逃
by zubizakeli @ 2018-02-23 22:05:22
@[zubizakeli](/space/show?uid=27388) 真的啊!!蟹蟹dalao
by wasa855 @ 2018-02-23 22:07:16