QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#265564 | #7753. Energy Distribution | ucup-team022# | WA | 722ms | 3908kb | C++14 | 727b | 2023-11-25 19:23:12 | 2023-11-25 19:23:13 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
double res[15];
double w[15][15];
double sum;
int n;
void calc(){
sum=0;
for(int i=1;i<=n;i++)
for(int j=i+1;j<=n;j++)
sum+=res[i]*res[j]*w[i][j];
}
int main(){
res[1]=1;
cin>>n;
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
cin>>w[i][j];
double T = 1;
double delta = 0.999999;
while(T>=1e-9){
int x = rand() % n + 1, y = rand() % n + 1;
double nres = sum;
double d = min({T,res[x]});
res[x] -= d;
res[y] += d;
calc();
if(sum<nres)res[x]+=d,res[y]-=d;
T *= delta;
}
calc();
cout << sum << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 427ms
memory: 3800kb
input:
2 0 1 1 0
output:
0.25
result:
ok found '0.2500000', expected '0.2500000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 570ms
memory: 3848kb
input:
3 0 2 1 2 0 2 1 2 0
output:
0.571429
result:
ok found '0.5714290', expected '0.5714290', error '0.0000000'
Test #3:
score: 0
Accepted
time: 565ms
memory: 3908kb
input:
3 0 1 2 1 0 1 2 1 0
output:
0.5
result:
ok found '0.5000000', expected '0.5000000', error '0.0000000'
Test #4:
score: 0
Accepted
time: 594ms
memory: 3804kb
input:
4 0 3 1 0 3 0 1 0 1 1 0 2 0 0 2 0
output:
0.75
result:
ok found '0.7500000', expected '0.7500000', error '0.0000000'
Test #5:
score: 0
Accepted
time: 674ms
memory: 3800kb
input:
5 0 0 0 4 4 0 0 2 0 4 0 2 0 2 0 4 0 2 0 0 4 4 0 0 0
output:
1
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #6:
score: -100
Wrong Answer
time: 722ms
memory: 3796kb
input:
6 0 9 5 5 10 6 9 0 0 0 0 1 5 0 0 0 3 0 5 0 0 0 10 5 10 0 3 10 0 0 6 1 0 5 0 0
output:
2.85714
result:
wrong answer 1st numbers differ - expected: '2.8571430', found: '2.8571400', error = '0.0000010'