QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#535944#9220. Bus AnalysisPhantomThreshold#WA 1ms11744kbC++201.8kb2024-08-28 16:57:482024-08-28 16:57:49

Judging History

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

  • [2024-08-28 16:57:49]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:11744kb
  • [2024-08-28 16:57:48]
  • 提交

answer

#include<bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
#define ll long long
//#define int long long
using namespace std;
//using namespace __gnu_pbds;
//#define double long double

const int maxn = 1050;
const int mod  = 1e9+7;
inline void add(int &a,const int &b){ a+=b;if(a>=mod)a-=mod; }

int n;
int a[maxn];
int f[maxn][maxn],g[maxn][maxn];
int tf[maxn],tg[maxn];

signed main()
{
	/////////////////////////////////////////////////
	//freopen("tmp.in","r",stdin);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	a[++n]= 1e9+1000;
	
	tg[1]++;
	for(int i=1,sumf=0,sumg=0;i<=n;i++)
	{
		add(sumf,tf[i]);
		add(sumg,tg[i]);
		
		add(f[i][i],sumf);
		add(g[i][i],sumg);
		
		for(int j=i;j<=n;j++) if(f[i][j]||g[i][j])
		{
			int cf=f[i][j], cg=g[i][j];
			
			for(int k=max(i+1,j);k<=n;k++) 
			{
				if(a[k]<a[i]+20)
				{
					cf=(cf<<1)%mod;
					cg=(cg<<1)%mod;
				}
				else if( a[k]<a[i]+75 )
				{
					int bg=k+1,tmp=1;
					while( bg<=n && a[k]+20>a[bg] ) bg++,tmp<<=1;
					
					int ed=k+1;
					while( ed<=n && a[i]+75>a[ed] ) ed++;
					
					for(int l=bg;l<=n;l++)
					{
						if( a[l]+20 >= a[i]+75 )
						{
							add(f[k][l], (ll)cf*tmp%mod );
							add(f[k][l], (ll)cg*tmp%mod*2%mod );
							add(g[k][l], (ll)cg*tmp%mod );
							break;
						}
						else // a[l]<=a[i]+75
						{
							int tmp2=1<<(ed-1-l);
							add(tf[ed], (ll)cf*tmp%mod*tmp2%mod );
							add(tf[ed], (ll)cg*tmp%mod*tmp2%mod*6%mod );
							add(tg[ed], (ll)cg*tmp%mod*tmp2%mod );
						}
					}
				}
				else if( a[k] >= a[i]+75 )
				{
					add(tf[k],cf);
					add(tf[k],(ll)cg*2%mod);
					add(tg[k],cg);
					break;
				}
			}
		}
	}
	cout<<f[n][n]<<endl;
	
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3728kb

input:

3
1 8 20

output:

14

result:

ok 1 number(s): "14"

Test #2:

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

input:

5
25 45 65 85 1000000000

output:

156

result:

ok 1 number(s): "156"

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 11744kb

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:

121924669

result:

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