QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#529344#9220. Bus Analysisucup-team3555#WA 12ms3928kbC++142.0kb2024-08-24 12:19:082024-08-24 12:19:13

Judging History

你现在查看的是最新测评结果

  • [2024-08-24 12:19:13]
  • 评测
  • 测评结果:WA
  • 用时:12ms
  • 内存:3928kb
  • [2024-08-24 12:19:08]
  • 提交

answer

/*
赛场风云变幻间,
治程独步算法巅。
代码编织成胜网,
智慧花开满园春。
*/

# include <bits/stdc++.h>

const int N=1010,INF=0x3f3f3f3f,mod=1e9+7;

inline int read(void){
	int res,f=1;
	char c;
	while((c=getchar())<'0'||c>'9')
		if(c=='-') f=-1;
	res=c-48;
	while((c=getchar())>='0'&&c<='9')
		res=res*10+c-48;
	return res*f;
}

int n;
int t[N];

int f[N];

inline int adc(int a,int b){
	return (a+b>=mod)?(a+b-mod):(a+b);
}
inline int dec(int a,int b){
	return (a<b)?(a-b+mod):(a-b);
}
inline int mul(int a,int b){
	return 1ll*a*b%mod;
}
inline void add(int &a,int b){
	a=adc(a,b);
}

std::unordered_map <int,int> mp;

int dp[90][30][5];

inline void calc(int t){
	memset(dp,0,sizeof(dp));
	dp[0][19][1]=1;
	dp[0][0][0]=1;
	
	for(int i=1;i<=74;++i){
		for(int j=0;j<=19;++j){ // no checker
			for(int k=0;k<=4;++k)
				add(dp[i][std::max(j-1,0)][k],dp[i-1][j][k]);
		}
		if(mp[t-i]){
			for(int j=0;j<=19;++j){
				for(int k=0;k<=4;++k){
					if(j) add(dp[i][j-1][k],dp[i-1][j][k]);
					else add(dp[i][19][std::min(k+1,4)],dp[i-1][j][k]);
				}
			}
		}
	}
	return;
}

inline int pre(int x){
	return std::lower_bound(t+1,t+1+n,x)-t-1;
}

int pw[N];

int main(void){
//	freopen("in.txt","r",stdin);
	n=read();
	
	for(int i=1;i<=n;++i) t[i]=read(),mp[t[i]]=true;
	
	pw[0]=1;
	for(int i=1;i<=n;++i) pw[i]=1ll*pw[i-1]*2%mod;
	
	for(int i=1;i<=n;++i){
		calc(t[i]);
		
		int tot=0;
		
		for(int j=0;j<=19;++j){
//			printf("j = %d: ",j);			
			for(int k=0;k<=4;++k){
				tot+=dp[74][j][k];
//				printf("%d ",dp[74][j][k]);				
//				printf("j = %d k = %d ways = %d\n",j,k,dp[75][j][k]);
//				assert(pre(t[i]-75)>=0);
//				assert(pre(t[i]-75-j)>=0);
				
				if(k==4) add(f[i],mul(dp[74][j][k],adc(f[pre(t[i]-74)],mul(6,pw[pre(t[i]-74)]))));
				else add(f[i],mul(dp[74][j][k],adc(f[pre(t[i]-74-j)],mul(2*k,pw[pre(t[i]-74-j)]))));
			}
//			puts("");
		}
//		printf("tt = %d\n",tot);
//		printf("fi = %d\n",f[i]);
		
	}
	printf("%d",f[n]);

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3860kb

input:

3
1 8 20

output:

14

result:

ok 1 number(s): "14"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3844kb

input:

5
25 45 65 85 1000000000

output:

156

result:

ok 1 number(s): "156"

Test #3:

score: -100
Wrong Answer
time: 12ms
memory: 3928kb

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:

866358720

result:

wrong answer 1st numbers differ - expected: '932594593', found: '866358720'