QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#530149#9220. Bus Analysisucup-team1004#WA 7ms21032kbC++141.8kb2024-08-24 15:02:382024-08-24 15:02:38

Judging History

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

  • [2024-08-24 15:02:38]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:21032kb
  • [2024-08-24 15:02:38]
  • 提交

answer

#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
#define all(x) x.begin(),x.end()
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;
const int N=1000+5,M=N*2+5,K=1e7+5,mod=1e9+7,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;mt19937 rnd(263082);
#define Tp template<typename T>
#define Ts template<typename T,typename... Ar>
namespace Debug{
	Tp void _debug(char* f,T t){cerr<<f<<'='<<t<<endl;}
	Ts void _debug(char* f,T x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
	#ifdef LOCAL
	#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
	#else 
	#define gdb(...) void()
	#endif
}using namespace Debug;
int n,A[N];
ll f[N][21][56],g[N][21][56];
ll pw[N];
void Solve(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&A[i]);
	for(int i=pw[0]=1;i<=n;i++) pw[i]=pw[i-1]*2%mod;
	A[n+1]=A[n]+100;
	f[1][0][0]=0;g[1][0][0]=1;
	for(int i=1;i<=n;i++){
		for(int x=0;x<=20;x++) for(int y=0;y<=55;y++) if(f[i][x][y]||g[i][x][y]){
			(f[i+1][max(0,x-1)][max(0,y-1)]+=f[i][x][y])%=mod;
			(g[i+1][max(0,x-1)][max(0,y-1)]+=g[i][x][y])%=mod;
			int z=i+1;
			while(A[z]-A[i]<20) z++;
			z=max(z,i+x);
			int v=i+1;
			while(A[v]-A[i]<75) v++;
			(f[z][max(0,y+i-z)][max(v-z,0)]+=(f[i][x][y]+g[i][x][y])*pw[z-i-1])%=mod;
			(g[z][max(0,y+i-z)][max(v-z,0)]+=g[i][x][y]*pw[z-i-1])%=mod;
		}
	}
	printf("%lld\n",f[n+1][0][0]%mod*2%mod);
}
int main(){
	int t=1;
	// scanf("%d",&t);
	while(t--) Solve();
	cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}

詳細信息

Test #1:

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

input:

3
1 8 20

output:

14

result:

ok 1 number(s): "14"

Test #2:

score: 0
Accepted
time: 1ms
memory: 5976kb

input:

5
25 45 65 85 1000000000

output:

156

result:

ok 1 number(s): "156"

Test #3:

score: 0
Accepted
time: 7ms
memory: 21032kb

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:

932594593

result:

ok 1 number(s): "932594593"

Test #4:

score: -100
Wrong Answer
time: 2ms
memory: 7832kb

input:

200
1 2 4 9 10 11 12 15 16 17 18 19 22 24 27 28 33 36 37 39 43 44 45 47 48 49 50 51 52 56 60 61 62 63 68 70 71 72 73 74 78 80 81 84 86 92 93 98 99 100 102 105 107 108 110 111 114 115 116 122 123 125 129 132 133 135 137 138 139 141 142 143 144 149 150 151 152 153 154 155 159 160 165 171 172 174 176 1...

output:

317119834

result:

wrong answer 1st numbers differ - expected: '422301620', found: '317119834'