QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#508960#4403. Measuresbachbeo200724 143ms7192kbC++23715b2024-08-07 22:39:012024-08-07 22:39:02

Judging History

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

  • [2024-08-07 22:39:02]
  • 评测
  • 测评结果:24
  • 用时:143ms
  • 内存:7192kb
  • [2024-08-07 22:39:01]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int N,M,D;cin >> N >> M >> D;D*=2;
    vector<int> a(N);
    for(int i=0;i<N;i++) cin >> a[i],a[i]*=2;
    for(int i=0;i<M;i++){
        int X;cin >> X;
        a.push_back(X*2);
        sort(a.begin(),a.end());
        int x=a[0],k=0;
        for(int j=1;j<=N+i;j++){
            int y=a[j];
            if(x+D<=y+k) x=max(x+D,y-k);
            else{
                k+=(x+D-y-k)/2;
                x=y+k;
            }
        }
        cout << k/2;
        if(k&1) cout << ".5";
        cout << ' ';
    }
    cout << '\n';
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 1ms
memory: 3564kb

input:

2000 10 1845
533219610 452539353 832124174 883897563 447321676 368976465 166536135 758380924 920827481 313174994 781707618 815047867 925081003 325012331 69086835 637564067 429273345 781597586 376641056 72157101 36547962 656170271 772458737 707141316 33546435 166034841 747620387 663158697 852912826 9...

output:

841.5 841.5 841.5 841.5 841.5 841.5 841.5 841.5 841.5 841.5 

result:

ok single line: '841.5 841.5 841.5 841.5 841.5 841.5 841.5 841.5 841.5 841.5 '

Test #2:

score: 10
Accepted
time: 1ms
memory: 3624kb

input:

2000 10 18453
15731 19943 24157 28373 32591 36811 41033 45257 49483 53711 57941 62173 66407 70643 74881 79121 83363 87607 91853 96101 100351 104603 108857 113113 117371 121631 125893 130157 134423 138691 142961 147233 151507 155783 160061 164341 168623 172907 177193 181481 185771 190063 194357 19865...

output:

12242000 12247120.5 12252240 12257358.5 12262476 12267592.5 12272708 12277822.5 12282936 12288048.5 

result:

ok single line: '12242000 12247120.5 12252240 1...12277822.5 12282936 12288048.5 '

Test #3:

score: 10
Accepted
time: 1ms
memory: 3636kb

input:

2000 10 183
687063759 687063759 687063759 687063759 687063759 687063759 687063759 687063759 687063759 687063759 687063759 687063759 687063759 687063759 687063759 687063759 687063759 687063759 687063759 687063759 687063759 687063759 687063759 687063759 687063759 687063759 687063759 687063759 68706375...

output:

183000 183091.5 183183 183274.5 183366 183457.5 183549 183640.5 183732 183823.5 

result:

ok single line: '183000 183091.5 183183 183274....83549 183640.5 183732 183823.5 '

Test #4:

score: 10
Accepted
time: 1ms
memory: 3792kb

input:

2000 10 7839
1104882 11557593 17250624 872120 2610939 3168410 19793876 15923377 12558592 8012464 3832981 20410098 21176008 11809662 16650803 3325375 18801530 10601271 19898055 2718936 16771672 20906144 738601 942896 6133368 7083258 5682092 20405279 11421184 22198704 8041726 5327160 1116282 13053727 ...

output:

6553 6553 6553 6553 6553 6553 6553 6553 6553 6553 

result:

ok single line: '6553 6553 6553 6553 6553 6553 6553 6553 6553 6553 '

Test #5:

score: 10
Accepted
time: 1ms
memory: 3500kb

input:

2000 10 739
1 740 1479 2218 2957 3696 4435 5174 5913 6652 7391 8130 8869 9608 10347 11086 11825 12564 13303 14042 14781 15520 16259 16998 17737 18476 19215 19954 20693 21432 22171 22910 23649 24388 25127 25866 26605 27344 28083 28822 29561 30300 31039 31778 32517 33256 33995 34734 35473 36212 36951 ...

output:

0 0 0 0 0 0 0 0 0 0 

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 '

Test #6:

score: 10
Accepted
time: 1ms
memory: 3568kb

input:

2000 10 693863
1 1000000000 480943 999669197 565391 999666029 886463 999291533 1249015 998911315 1478174 998873791 1643910 998800730 2090062 998349218 2347718 998157249 2733042 997720305 3169022 997381640 3277592 997088828 3497572 997009332 3567289 996980677 3701759 996594181 3962951 996234981 42561...

output:

220646989.5 220646989.5 220840733 220840733 221133776.5 221133776.5 221294708 221294708 221444150.5 221444150.5 

result:

ok single line: '220646989.5 220646989.5 220840...294708 221444150.5 221444150.5 '

Test #7:

score: 10
Accepted
time: 1ms
memory: 3788kb

input:

2000 10 63
59351 86565 119326 96018 26653 54561 83792 99231 64897 45739 132 83986 21490 68362 54246 43601 83102 19156 36418 11788 103451 119074 118824 29552 5109 56957 85307 91544 105780 50721 35410 17960 118572 117811 4543 103636 72580 1203 95893 119008 101306 107103 33580 47377 40325 49273 635 668...

output:

3 3 3 3 3 3 3 3 3 3 

result:

ok single line: '3 3 3 3 3 3 3 3 3 3 '

Test #8:

score: 10
Accepted
time: 1ms
memory: 3640kb

input:

2000 10 56903845
127114 197411 1751728 1874621 2165212 3716390 3843654 3933149 4159859 5120856 5188293 5242118 7085138 7775976 12194564 12602079 13461967 14456365 14904923 15391671 19752717 20090124 20139792 20559656 20693437 21047553 21312167 22103298 22355758 22697350 22706420 24725181 26596102 26...

output:

56405845112.5 56434272288 56462364146.5 56490797101 56519140756 56547265108.5 56575660598 56603615491.5 56632007948.5 56660232802.5 

result:

ok single line: '56405845112.5 56434272288 5646....5 56632007948.5 56660232802.5 '

Subtask #2:

score: 14
Accepted

Test #9:

score: 14
Accepted
time: 87ms
memory: 6208kb

input:

200000 10 128
853561279 93820692 821887507 753094209 227461682 691969137 519378763 296675314 646705609 727762559 98496302 959430593 403972779 982596953 775241610 209602833 112152326 762927950 619981024 764326855 379819398 392809293 145648647 960106249 514225957 952027167 428472167 571874662 95085242...

output:

167 167 167 167 167 167 167 167 167 167 

result:

ok single line: '167 167 167 167 167 167 167 167 167 167 '

Test #10:

score: 14
Accepted
time: 131ms
memory: 6656kb

input:

200000 10 6850386
2684591 6734660 10784731 14834804 18884879 22934956 26985035 31035116 35085199 39135284 43185371 47235460 51285551 55335644 59385739 63435836 67485935 71536036 75586139 79636244 83686351 87736460 91786571 95836684 99886799 103936916 107987035 112037156 116087279 120137404 124187531...

output:

684538602443.5 684542027636.5 684545452829.5 684548878022.5 684552303215.5 684555728408.5 684559153601.5 684562578794.5 684566003987.5 684569429180.5 

result:

ok single line: '684538602443.5 684542027636.5 ... 684566003987.5 684569429180.5 '

Test #11:

score: 14
Accepted
time: 31ms
memory: 7192kb

input:

200000 10 4486
857631169 857631169 857631169 857631169 857631169 857631169 857631169 857631169 857631169 857631169 857631169 857631169 857631169 857631169 857631169 857631169 857631169 857631169 857631169 857631169 857631169 857631169 857631169 857631169 857631169 857631169 857631169 857631169 85763...

output:

448600000 448602243 448604486 448606729 448608972 448611215 448613458 448615701 448617944 448620187 

result:

ok single line: '448600000 448602243 448604486 ... 448615701 448617944 448620187 '

Test #12:

score: 14
Accepted
time: 143ms
memory: 6224kb

input:

200000 10 697048
1615380 101180 641216 742032 1567593 600170 241860 1021953 1149207 2100296 1272309 1354964 2029412 597565 887502 976008 1404381 1837659 632700 50460 932908 1020384 126420 1061226 1670138 197328 1718544 1307694 811296 1881376 1111143 965041 171096 1496688 1765977 1162560 845980 17225...

output:

69204802152.5 69205150676.5 69205499200.5 69205847724.5 69206196248.5 69206544772.5 69206893296.5 69207241820.5 69207590344.5 69207938868.5 

result:

ok single line: '69204802152.5 69205150676.5 69....5 69207590344.5 69207938868.5 '

Test #13:

score: 14
Accepted
time: 26ms
memory: 7188kb

input:

200000 10 12
1 13 25 37 49 61 73 85 97 109 121 133 145 157 169 181 193 205 217 229 241 253 265 277 289 301 313 325 337 349 361 373 385 397 409 421 433 445 457 469 481 493 505 517 529 541 553 565 577 589 601 613 625 637 649 661 673 685 697 709 721 733 745 757 769 781 793 805 817 829 841 853 865 877 8...

output:

0 0 0 0 0 0 0 0 0 0 

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 '

Test #14:

score: 14
Accepted
time: 80ms
memory: 6200kb

input:

200000 10 863
1 1000000000 3394 999998271 4669 999994786 9232 999991037 11967 999988500 12327 999983865 16284 999979370 19250 999975638 20409 999972351 24387 999971383 27077 999970128 29216 999965864 32154 999962202 37088 999961247 38901 999957667 41513 999956460 44567 999955186 47435 999950881 4956...

output:

1662 1662 1662 1662 1662 1662 1662 1662 1662 1662 

result:

ok single line: '1662 1662 1662 1662 1662 1662 1662 1662 1662 1662 '

Test #15:

score: 14
Accepted
time: 78ms
memory: 6688kb

input:

200000 10 1
71445 28286 181293 171423 145156 118534 53574 145018 117091 174489 20354 149054 54504 47237 130428 164516 190948 155792 78128 108066 123408 29644 41529 193560 59048 866 80033 85344 84436 100972 35311 44801 119256 85350 89423 132681 78058 1257 194911 150910 44162 133509 156644 35188 13518...

output:

0 0 0 0 0 0 0 0 0 0 

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 '

Test #16:

score: 14
Accepted
time: 31ms
memory: 6196kb

input:

200000 10 947583758
11137 13340 17899 26872 27673 30628 31076 37960 43766 46355 51599 51971 52877 61574 64046 66201 69853 70486 70925 75121 76678 79178 81082 90860 93211 95799 101354 101563 102410 108034 109523 116664 137112 138075 138391 152169 155111 159250 164155 164202 170871 170990 177779 19454...

output:

94757875833224 94758349611480 94758823403193.5 94759297191847 94759770982761.5 94760244772572 94760718563495.5 94761192355290.5 94761666144155.5 94762139934950.5 

result:

ok single line: '94757875833224 94758349611480 ...61666144155.5 94762139934950.5 '

Subtask #3:

score: 0
Time Limit Exceeded

Test #17:

score: 0
Time Limit Exceeded

input:

0 200000 1289

3822 6378 8930 10621 14339 15484 27804 30714 47103 51268 51740 57420 74974 81161 81292 82797 84329 92397 96558 102781 108313 117355 117730 121011 121917 123170 124479 132083 144850 152609 153404 161406 162584 163062 172029 172074 172504 178451 185861 197247 197729 204944 223883 245287...

output:

0 0 0 0 0 72 72 72 72 72 408.5 408.5 408.5 408.5 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 622 1051.5 1051.5 1051.5 1051.5 1051.5 1051.5 1051.5 1051.5 1051.5 1051.5 1051.5 1051.5 1051.5 1051.5 1051.5 1051.5 1051.5 1051.5 1051.5 1051.5 1051.5 1051.5 1051.5 10...

result:


Subtask #4:

score: 0
Time Limit Exceeded

Test #34:

score: 0
Time Limit Exceeded

input:

0 200000 1289

582772771 851704216 915624354 601264573 510202549 844706968 795870015 897865316 665295826 172582259 59358299 239645315 343442424 973625659 840972987 546781500 897704802 602265737 968590815 561687707 728916679 417806750 143659623 620408739 86393298 403049850 578760184 735385586 7656173...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result: