QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#68530#1651. Modulo PermutationshuxiaoyeWA 2ms3280kbC++14572b2022-12-17 09:55:382022-12-17 09:55:40

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-12-17 09:55:40]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3280kb
  • [2022-12-17 09:55:38]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int dp[105][105];
int a[105];
int DP(int n)
{
    for(int len=3;len<=n;len++)
    {
        for(int l=1;l+len-1<=n;l++)
        {
            int r=l+len-1;
            dp[l][r]=(1<<31)-1;
            for(int k=l+1;k<=r;k++)
            {
                dp[l][r]=min(dp[l][r],dp[l][k]+dp[k][r]+a[l]*a[k]*a[r]);
            }

        }
    }
    return dp[1][n];
}
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    cout<<DP(n)<<endl;
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3280kb

input:

1

output:

0

result:

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