QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#68530 | #1651. Modulo Permutations | huxiaoye | WA | 2ms | 3280kb | C++14 | 572b | 2022-12-17 09:55:38 | 2022-12-17 09:55:40 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3280kb
input:
1
output:
0
result:
wrong answer 1st lines differ - expected: '1', found: '0'