QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#50895 | #4629. Longest Increasing Subsequence | Appleblue17 | WA | 2ms | 3644kb | C++14 | 764b | 2022-09-29 16:16:41 | 2022-09-29 16:16:45 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const long long N=1e5+5,M=66;
long long n,m=60;
long long a[N];
long long dp[N][M];
int main(){
cin>>n; n--;
for(long long i=0;i<=n;i++) cin>>a[i];
dp[0][0]=1;
for(long long i=1;i<=n;i++){
long long x=a[i]-a[i-1];
long long t=0;
while((1ll<<(t+1))<x) t++;
long long c=x-(1ll<<t),s;
if(c<=(1ll<<(t-1))) s=(1ll<<(t-1))+1;
else s=min(1ll<<t,c+1);
for(long long j=0;j<=m;j++){
for(long long k=0;k<j;k++){
long long l=k+1,r=j,w;
if(r==0) w=1;
else if(r<=t) w=1ll<<(t-1);
else if(l==t+1) w=c;
else w=s;
dp[i][j]=max(dp[i][j],dp[i-1][k]+w);
}
}
// for(long long j=0;j<=m;j++) cout<<dp[i][j]<<" ";
// cout<<endl;
}
cout<<dp[n][m];
}
详细
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3644kb
input:
7 7 41 53 58 75 78 81
output:
39
result:
wrong answer 1st lines differ - expected: '22', found: '39'