QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#583668 | #9220. Bus Analysis | EXODUS | WA | 347ms | 7488kb | C++17 | 2.4kb | 2024-09-22 21:07:30 | 2024-09-22 21:07:30 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i,l,r) for(int i(l);i<=(r);++i)
#define per(i,r,l) for(int i(r);i>=(l);--i)
#define eb emplace_back
#define Debug(...) fprintf(stderr,__VA_ARGS__)
#define Exit(p) fprintf(stderr,"[exit]: at breakpoint %d\n",p),exit(0);
#define File(filename) freopen(filename ".in","r",stdin),freopen(filename ".out","w",stdout)
template<typename T>void read(T &x){x=0;T flg=1;char ch=getchar();while(!isdigit(ch)){if(ch=='-')flg=-1;ch=getchar();}while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^48),ch=getchar();x*=flg;}
template<typename T,typename... Args>void read(T &x,Args &...args){read(x),read(args...);}
template<typename T>void cmax(T& x,T y){x=max(x,y);}
template<typename T,typename... Args>void cmax(T& x,T y,Args ...args){cmax(x,y);cmax(x,args...);}
template<typename T>void cmin(T& x,T y){x=min(x,y);}
template<typename T,typename... Args>void cmin(T& x,T y,Args ...args){cmin(x,y);cmin(x,args...);}
template<typename T,typename U>ostream &operator<<(ostream &os,const pair<T,U>&x){return os<<"("<<x.first<<","<<x.second<< ")"; };
template<typename T>ostream &operator<<(ostream &os,const vector<T> &as){const int sz=as.size();os<<"[";for(int i=0;i<sz;++i){if(i>=256){os<<",...";break;}if(i>0){os<<",";}os<<as[i];}return os<<"]";}
bool membg=0;
constexpr int N=1e3+7,M=77,mod=1e9+7;
int n,ans,a[N],pwr[N],f[M][M][M],g[M][M][M];
void add(int &x,int y){x+=y-mod;x+=x>>31&mod;}
bool memed=0;
void solve(){
read(n);
for(int i=1;i<=n;i++)read(a[i]);
f[0][0][0]=pwr[0]=1;
for(int i=1;i<=n;i++)pwr[i]=pwr[i-1]*2%mod;
for(int i=1;i<=n;i++){
memcpy(g,f,sizeof(g));
memset(f,0,sizeof(f));
int dlt=a[i]-a[i-1];
for(int x=0;x<M;x++)
for(int y=0;y<M;y++)
for(int z=0;z<M;z++)
if(g[x][y][z]){
int tx=max(0,x-dlt),ty=max(0,y-dlt),tz=max(0,z-dlt);
int tmp[4]={tx,ty,tz,0},k=tx==0;
for(int j=0;j<3;j++){
tmp[j+1]=max(tmp[j+1],tmp[j]+20);
if(!j)tmp[j+3]=max(tmp[j+3],tmp[j]+75);
}
add(f[tmp[0]][tmp[1]][tmp[2]],g[x][y][z]);
add(f[tmp[k]][tmp[k+1]][tmp[k+2]],g[x][y][z]);
add(ans,g[x][y][z]*pwr[n-i]*k);
}
}
printf("%d\n",ans*2%mod);
return;
}
int main(){
Debug("%.3lfMB\n",fabs(&memed-&membg)/1024.0/1024.0);
int timbg=clock();
int T=1;
while(T--)solve();
int timed=clock();
Debug("%.3lfs\n",1.0*(timed-timbg)/CLOCKS_PER_SEC);
fflush(stdout);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 7488kb
input:
3 1 8 20
output:
14
result:
ok 1 number(s): "14"
Test #2:
score: 0
Accepted
time: 3ms
memory: 7476kb
input:
5 25 45 65 85 1000000000
output:
156
result:
ok 1 number(s): "156"
Test #3:
score: -100
Wrong Answer
time: 347ms
memory: 7396kb
input:
1000 2 7 9 12 14 17 18 21 22 28 29 33 34 35 37 38 44 45 46 50 58 59 63 66 71 72 75 76 77 78 80 81 83 84 87 92 100 101 107 108 109 112 114 116 118 123 124 131 142 143 144 145 148 150 151 152 153 155 157 158 165 167 168 169 171 176 182 185 190 192 198 202 204 205 212 213 223 224 225 226 229 231 240 24...
output:
285399619
result:
wrong answer 1st numbers differ - expected: '932594593', found: '285399619'