QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#503531#4629. Longest Increasing Subsequencetarjen#WA 0ms3528kbC++201.1kb2024-08-03 19:44:562024-08-03 19:44:56

Judging History

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

  • [2024-08-03 19:44:56]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3528kb
  • [2024-08-03 19:44:56]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N=65;
typedef array<int,N> info;
info operator+(info x,info y){
    for(int i=0;i<N;i++)x[i]+=y[i];
    return x;
}
void mv(info &x){
    for(int i=N-1;i>=1;i--)x[i]=x[i-1];
    x[0]=1;
}
info dfs(int len){
    int mid=(1+len)/2;
    info p{0};
    if(mid>=3)p=dfs(mid);
    if(len-mid+1>=3)p=p+dfs(len-mid+1);
    mv(p);
    return p;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;cin>>n;
    vector<int> a(n+1);
    info dp{0};
    for(int i=1;i<=n;i++)cin>>a[i];
    for(int i=1;i<n;i++){
        info now{0},dp2{0};
        if(a[i+1]-a[i]+1>=3)now=dfs(a[i+1]-a[i]+1);
        mv(now);
        // cout<<"i="<<i<<endl;
        // for(int j=0;j<5;j++){
        //     cout<<now[j]<<" \n"[j==4];
        // }
        for(int j=0;j<N;j++){
            for(int k=j;k<N;k++)if(dp[j]+now[k]>dp2[k]&&now[k]>0)dp2[k]=dp[j]+now[k]+(k!=j);
        }
        dp=dp2;
    }
    dp[0]++;
    int ans=0;
    for(int i=0;i<N;i++)if(dp[i])ans=max(ans,dp[i]);
    cout<<ans;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3528kb

input:

7
7 41 53 58 75 78 81

output:

11

result:

wrong answer 1st lines differ - expected: '22', found: '11'