QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#600941 | #7753. Energy Distribution | TJUHuangTao# | WA | 21ms | 4528kb | C++20 | 1.4kb | 2024-09-29 20:03:58 | 2024-09-29 20:04:03 |
Judging History
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;
}
详细
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'