QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#748476 | #5304. Money Game | zaqmju# | WA | 996ms | 4000kb | C++23 | 886b | 2024-11-14 20:30:02 | 2024-11-14 20:30:04 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define LF(x) fixed << setprecision(x)
const int N = 1e8 + 8e7 + 2e6;
void solve() {
int n; cin >> n;
vector<int>a(n);
int m = N / n;
for(auto &i:a)cin >> i;
vector<long double> b(n);
for(int i = 0; i < n; i++)b[i] = 1.0 * a[i];
auto cal = [&](vector<long double> &v) -> void{
for(int i = 0; i < n - 1; i++){
v[i + 1] += v[i] / 2.0;
v[i] /= 2.0;
}
v[0] += v[n - 1] / 2.0;
v[n - 1] /= 2.0;
};
int cnt = 1;
cal(b);
while(cnt < m){
cnt++;
cal(b);
// for(auto i:b)cout << i <<' ';
// cout <<endl;
}
// cout << cnt << endl;
for(int i = 0; i < n; i++) {
cout << LF(10) << b[i] << " ";
}
// cout << endl;
}
#undef int
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t = 1;
// cin >> t;
while(t--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 992ms
memory: 3768kb
input:
2 4 2
output:
4.0000000000 2.0000000000
result:
ok 2 numbers
Test #2:
score: 0
Accepted
time: 996ms
memory: 3768kb
input:
2 2 3
output:
3.3333333333 1.6666666667
result:
ok 2 numbers
Test #3:
score: 0
Accepted
time: 995ms
memory: 3876kb
input:
2 851648 722281
output:
1049286.0000000000 524643.0000000000
result:
ok 2 numbers
Test #4:
score: 0
Accepted
time: 961ms
memory: 3772kb
input:
3 450762 114467 367746
output:
466487.5000000000 233243.7500000000 233243.7500000000
result:
ok 3 numbers
Test #5:
score: 0
Accepted
time: 943ms
memory: 3908kb
input:
4 2 3 5 1
output:
4.4000000000 2.2000000000 2.2000000000 2.2000000000
result:
ok 4 numbers
Test #6:
score: 0
Accepted
time: 929ms
memory: 3768kb
input:
5 616288 155735 783782 648639 349827
output:
851423.6666666667 425711.8333333333 425711.8333333333 425711.8333333333 425711.8333333333
result:
ok 5 numbers
Test #7:
score: 0
Accepted
time: 922ms
memory: 3780kb
input:
6 1 2 5 5 1 2
output:
4.5714285714 2.2857142857 2.2857142857 2.2857142857 2.2857142857 2.2857142857
result:
ok 6 numbers
Test #8:
score: 0
Accepted
time: 891ms
memory: 4000kb
input:
100 283397 377774 494372 487546 143741 314831 934818 229251 78798 395137 407818 18761 516178 734330 838264 433107 858247 174903 905002 445936 58127 253493 844807 215023 37167 11961 885588 176935 156947 82314 21120 373809 226377 712113 302554 613417 368577 604224 811349 182256 179860 424904 544075 16...
output:
848873.9009900990 424436.9504950495 424436.9504950495 424436.9504950495 424436.9504950495 424436.9504950495 424436.9504950495 424436.9504950495 424436.9504950495 424436.9504950495 424436.9504950495 424436.9504950495 424436.9504950495 424436.9504950495 424436.9504950495 424436.9504950495 424436.95049...
result:
ok 100 numbers
Test #9:
score: 0
Accepted
time: 890ms
memory: 3720kb
input:
100 5 3 4 3 3 5 1 4 1 5 5 4 2 5 2 4 2 2 5 2 3 4 3 3 1 3 1 5 4 5 4 2 3 1 4 2 2 3 4 5 2 5 2 2 1 2 1 4 2 2 3 4 4 2 1 2 5 3 2 2 1 5 4 2 3 1 3 1 4 5 4 1 1 5 3 3 2 3 5 4 2 4 3 3 2 3 5 2 3 5 5 4 4 1 5 4 5 4 2 1
output:
6.0792079208 3.0396039604 3.0396039604 3.0396039604 3.0396039604 3.0396039604 3.0396039604 3.0396039604 3.0396039604 3.0396039604 3.0396039604 3.0396039604 3.0396039604 3.0396039604 3.0396039604 3.0396039604 3.0396039604 3.0396039604 3.0396039604 3.0396039604 3.0396039604 3.0396039604 3.0396039604 3...
result:
ok 100 numbers
Test #10:
score: -100
Wrong Answer
time: 890ms
memory: 3980kb
input:
1000 752085 536931 226066 866464 865683 685497 869505 833061 583665 542381 226489 183898 682629 584879 968426 414809 258683 315749 204443 89329 66644 255718 884710 690597 216353 59071 257910 665131 979147 688114 99343 929069 829135 674291 849479 242572 654330 268521 645445 96088 960241 507763 482377...
output:
1019651.4158497163 509825.6598789438 509825.6357850961 509825.6116576990 509825.5874977030 509825.5633060600 509825.5390837233 509825.5148316470 509825.4905507868 509825.4662420993 509825.4419065422 509825.4175450744 509825.3931586557 509825.3687482469 509825.3443148098 509825.3198593070 509825.2953...
result:
wrong answer 1st numbers differ - expected: '1019649.5684316', found: '1019651.4158497', error = '0.0000018'