QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#638050 | #9220. Bus Analysis | lsj2009 | RE | 11ms | 12948kb | C++20 | 2.7kb | 2024-10-13 14:45:34 | 2024-10-13 14:45:36 |
Judging History
answer
#include<bits/stdc++.h>
//#pragma GCC optimize(3,"Ofast","inline")
//#define int long long
#define i128 __int128
#define ll long long
#define ull unsigned long long
#define uint unsigned int
#define ld double
#define PII pair<int,int>
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3f
#define chkmax(a,b) a=max(a,b)
#define chkmin(a,b) a=min(a,b)
#define rep(k,l,r) for(int k=l;k<=r;++k)
#define per(k,r,l) for(int k=r;k>=l;--k)
#define cl(f,x) memset(f,x,sizeof(f))
#define pcnt(x) __builtin_popcount(x)
#define lg(x) (31-__builtin_clz(x))
using namespace std;
void file_IO() {
// system("fc .out .ans");
freopen(".in","r",stdin);
freopen(".out","w",stdout);
}
bool M1;
template<int p>
struct mint {
int x;
mint() {
x=0;
}
mint(int _x) {
x=_x;
}
friend mint operator + (mint a,mint b) {
return a.x+b.x>=p? a.x+b.x-p:a.x+b.x;
}
friend mint operator - (mint a,mint b) {
return a.x<b.x? a.x-b.x+p:a.x-b.x;
}
friend mint operator * (mint a,mint b) {
return 1ll*a.x*b.x%p;
}
friend mint operator ^ (mint a,ll b) {
mint res=1,base=a;
while(b) {
if(b&1)
res*=base;
base*=base; b>>=1;
}
return res;
}
friend mint operator ~ (mint a) {
return a^(p-2);
}
friend mint operator / (mint a,mint b) {
return a*(~b);
}
friend mint & operator += (mint& a,mint b) {
return a=a+b;
}
friend mint & operator -= (mint& a,mint b) {
return a=a-b;
}
friend mint & operator *= (mint& a,mint b) {
return a=a*b;
}
friend mint & operator /= (mint& a,mint b) {
return a=a/b;
}
friend mint operator ++ (mint& a) {
return a+=1;
}
friend mint operator -- (mint& a) {
return a-=1;
}
};
const int MOD=1e9+7;
#define mint mint<MOD>
const int N=2e3+5,M=1e2+5,m=75;
mint f[2][M][M][M];
int t[N];
void solve() {
int n;
scanf("%d",&n);
f[0][0][0][0]=1;
mint res=0;
rep(i,1,n) {
scanf("%d",&t[i]);
int d=t[i]-t[i-1];
rep(a,0,m) {
rep(b,0,m) {
rep(c,0,m)
f[i&1][a][b][c]=0;
}
}
mint val=mint(2)^(n-i);
rep(a,0,m) {
rep(b,0,m) {
rep(c,0,m) {
int g[4]={max(a-d,0),max(b-d,0),max(c-d,0),max(a-d,0)+75};
rep(j,1,3)
chkmax(g[i],g[i-1]+20);
f[i&1][g[0]][g[1]][g[2]]+=f[(i-1)&1][a][b][c];
if(g[0])
f[i&1][g[0]][g[1]][g[2]]+=f[(i-1)&1][a][b][c];
else {
f[i&1][g[1]][g[2]][g[3]]+=f[(i-1)&1][a][b][c];
res+=f[(i-1)&1][a][b][c]*val;
}
}
}
}
}
printf("%d\n",(res*2).x);
}
bool M2;
signed main() {
//file_IO();
int testcase=1;
//scanf("%d",&testcase);
while(testcase--)
solve();
fprintf(stderr,"used time = %ldms\n",1000*clock()/CLOCKS_PER_SEC);
fprintf(stderr,"used memory = %lldMB\n",(&M2-&M1)/1024/1024);
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 7ms
memory: 12948kb
input:
3 1 8 20
output:
14
result:
ok 1 number(s): "14"
Test #2:
score: 0
Accepted
time: 11ms
memory: 12896kb
input:
5 25 45 65 85 1000000000
output:
156
result:
ok 1 number(s): "156"
Test #3:
score: -100
Runtime Error
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...