QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#225450 | #1697. Balance Beam | paul2008 | 18.181818 | 1ms | 3980kb | C++14 | 655b | 2023-10-24 17:41:17 | 2023-10-24 17:41:17 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N=5005;
const double eps=1e-6;
long long a[N];
int main()
{
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++)
scanf("%lld",&a[i]);
int l=0,r=0;
for(int i=1;i<=n;i++)
{
if(r<i)
{
if(i==199)
printf("YES\n");
l=i-1, r=i;
double val=a[i];
for(int j=i+1;j<=n;j++)
if((double)(a[l]*(j-i)+a[j])/(j-i+1)>val)
val=(double)(a[l]*(j-i)+a[j])/(j-i+1), r=j;
}
if(r>i)
{
double ans=(double)(a[l]*(r-i)+a[r]*(i-l))/(r-l);
long long res=ans*100000+eps;
printf("%lld\n",res);
}
else
printf("%lld\n",a[i]*100000);
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 9.09091
Accepted
time: 0ms
memory: 3980kb
input:
2 1 3
output:
150000 300000
result:
ok 2 lines
Test #2:
score: 0
Runtime Error
input:
100000 10550 10166 14944 34729 60262 25398 4608 4103 101193 91415 63390 56440 54875 168733 55861 115845 204889 86170 228991 45049 188746 174299 157006 230942 301295 28758 261824 283112 3483 361548 373598 385647 261775 110588 350711 61727 397275 359292 469989 100405 262091 249753 383032 300999 521216...
output:
result:
Test #3:
score: 0
Runtime Error
input:
100000 96 69 618 440 1643 2449 2117 73 470 4080 1853 1106 2589 4981 6118 4134 4702 3077 2592 8155 8562 6144 9375 5120 3709 18 11000 11405 8836 12214 11637 5468 10706 11093 14235 9866 15042 12766 15586 14034 11827 17058 10880 17863 15006 11739 15698 307 6830 17584 2846 21082 14912 21886 6967 7840 110...
output:
result:
Test #4:
score: 0
Wrong Answer
time: 0ms
memory: 3848kb
input:
200 86857 23812 79982 44721 28718 48332 86220 19866 23758 48884 24781 92876 58394 30676 50939 1246 77228 69833 9109 556 16565 75867 28884 59093 85906 14369 45990 60314 18861 30445 70991 5717 54256 50973 66796 99332 99297 53016 19197 39420 1899 60337 48662 60285 91012 15966 61531 68233 85791 87005 68...
output:
8685700000 8740418181 8795136363 8849854545 8904572727 8959290909 9014009090 9068727272 9123445454 9178163636 9232881818 9287600000 9314500000 9341400000 9368300000 9395200000 9422100000 9449000000 9475900000 9502800000 9529700000 9556600000 9583500000 9610400000 9637300000 9664200000 9691100000 971...
result:
wrong answer 199th lines differ - expected: '5130733333', found: 'YES'
Test #5:
score: 9.09091
Accepted
time: 1ms
memory: 3904kb
input:
5000 72083 34770 50448 76733 68071 44356 12800 25882 23411 61847 16071 72060 55263 60945 34424 53020 42724 63542 67935 83270 33043 38718 83427 34388 62968 70173 21833 51799 79193 53222 42211 67634 87991 9024 60726 72427 53373 89884 14667 93149 51730 30731 81567 6986 91668 15990 76371 50757 95891 443...
output:
7208300000 7363300000 7518300000 7673300000 7719534693 7765769387 7812004081 7858238775 7904473469 7950708163 7996942857 8043177551 8089412244 8135646938 8181881632 8228116326 8274351020 8320585714 8366820408 8413055102 8459289795 8505524489 8551759183 8597993877 8644228571 8690463265 8736697959 878...
result:
ok 5000 lines
Test #6:
score: 0
Runtime Error
input:
100000 42613 39648 57462 23706 42581 34382 11589 50774 50931 75743 25387 27284 87003 6993 79687 62698 48230 55958 56398 32739 15357 23709 43837 63327 75293 19706 99184 8645 97561 7812 79584 40173 63825 53405 63879 6405 87786 91833 73537 55075 83934 98924 98725 70936 22282 78411 49993 86870 34369 639...
output:
result:
Test #7:
score: 0
Runtime Error
input:
100000 126 176 450 531 845 960 230 2029 2013 2441 393 898 2963 396 737 1576 4686 4531 2548 2752 2937 3500 5263 3681 4832 139 6997 7064 6827 1909 996 2040 10621 7628 9694 2289 5908 5695 1652 12862 2098 5532 10892 8000 10477 14202 1137 306 4843 14167 4747 270 6973 12124 1864 8646 5054 11755 14676 8514...
output:
result:
Test #8:
score: 0
Runtime Error
input:
100000 76 320 230 1049 962 705 1290 1673 1370 572 873 3333 1530 3522 2985 4212 937 3528 3357 3933 6327 2801 5408 2537 1003 391 6600 6753 1950 4710 2494 3941 3426 6421 7121 7049 4959 8943 4434 1871 6061 528 7278 1237 6495 13185 9374 273 10115 9355 11733 4274 7866 16015 7578 12801 12699 9034 6295 1159...
output:
result:
Test #9:
score: 0
Runtime Error
input:
100000 285 1191 4032 4253 2028 6342 6259 129 12406 10505 1861 7574 7081 13668 20727 13386 18752 17757 26939 12650 7879 6210 28257 21004 28122 36862 103 26569 7459 40624 12927 12953 26705 18007 37564 38149 13381 9977 51047 50996 38898 13414 59125 36150 15396 49423 20199 1043 5212 62121 63394 33190 56...
output:
result:
Test #10:
score: 0
Runtime Error
input:
100000 3700 2515 19050 13718 42454 50943 15036 21588 17968 63237 68840 49149 110365 44575 118371 118979 138079 110883 128494 99640 146984 60252 166941 100574 30480 154004 219764 151278 163270 4936 62463 187683 57978 207856 276102 128289 122059 109461 331073 329012 312878 348679 289155 120329 119050 ...
output:
result:
Test #11:
score: 0
Runtime Error
input:
100000 234 72 826 1282 2883 6351 9173 4949 12623 4562 8352 9630 15317 17653 5224 17730 22248 11805 14165 9730 21425 935 21759 33803 31229 1903 13560 42166 1775 8762 8291 15655 15439 11824 27529 54213 21905 3239 31119 20433 22022 37367 42523 4878 40568 49055 61970 53282 17789 39217 76800 6074 7198 73...