QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#600941#7753. Energy DistributionTJUHuangTao#WA 21ms4528kbC++201.4kb2024-09-29 20:03:582024-09-29 20:04:03

Judging History

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

  • [2024-10-31 10:22:30]
  • hack成功,自动添加数据
  • (/hack/1089)
  • [2024-09-29 20:04:03]
  • 评测
  • 测评结果:WA
  • 用时:21ms
  • 内存:4528kb
  • [2024-09-29 20:03:58]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define db double
#define pii pair<int, int>
using namespace std;
const int N = 1000;
int e[12], w[12][12], n, ans;
bool check(){
    int sum = 0;
    for (int i = 1; i <= n; i++)
        for (int j = i + 1; j <= n; j++)
            sum += e[i] * e[j] * w[i][j];
    if(sum > ans){
        ans = sum;
        return 1;
    }
    return 0;
}
signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n; j++)
            cin >> w[i][j];

    int dp[n + 1][N+1]{};
    vector<vector<vector<int>>> dp2(n+1,vector<vector<int> >(N+1,vector<int>(11,0)));
    for (int i = 0; i <= N;i++)
        dp2[1][i][1] = i;
    for (int i = 2; i <= n;i++){
        for (int j = 0; j <= N;j++)
            for (int k = 0; k <= j;k++)
                {
                    vector <int> now = dp2[i - 1][k];
                    int val = 0;
                    for (int ii = 1; ii <= i;ii++)
                        val += now[ii] * (j - k)*w[i][ii];
                    if(val+dp[i-1][k]>=dp[i][j]){
                        dp[i][j] = val + dp[i - 1][k];
                        now[i] = j - k;
                        dp2[i][j] = now;
                        dp2[i][j][i] = j - k;
                    }
                }
    }
    cout <<fixed<<setprecision(10)<< dp[n][N] * 1.0 / (N * N);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 11ms
memory: 4440kb

input:

2
0 1
1 0

output:

0.2500000000

result:

ok found '0.2500000', expected '0.2500000', error '0.0000000'

Test #2:

score: -100
Wrong Answer
time: 21ms
memory: 4528kb

input:

3
0 2 1
2 0 2
1 2 0

output:

0.5625000000

result:

wrong answer 1st numbers differ - expected: '0.5714290', found: '0.5625000', error = '0.0089290'