QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#832440#9848. Paid LeaveisWFnoya#WA 88ms8428kbC++23710b2024-12-25 21:28:582024-12-25 21:28:59

Judging History

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

  • [2024-12-25 21:28:59]
  • 评测
  • 测评结果:WA
  • 用时:88ms
  • 内存:8428kb
  • [2024-12-25 21:28:58]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=1919810;
typedef long long ll;
ll n,m,x,y,k;
// int op[N],num[N];
ll a[N];
// ll x;
ll ans;
ll leave;

void cal(ll l,ll r){
    if(l>r) return;

    ll res=y+2;
    ll len=r-l+1;
    ll step=x;
    if(y-leave<x){
        step=y-leave;
    } 

    ll num=len/res;
    ans+=num*2;
    len-=num*res;
    // cout<<l<<" "<<r<<" "<<num<<endl;
    if(len>step){
        ans++;
        leave=max(0ll,len-(step+1));
    }else{
        leave=len;
    }
}

int main(){
    cin>>n>>m>>x>>y;
    for(int i=1;i<=m;i++) cin>>a[i];
    a[m+1]=n;
    for(int i=1;i<=m+1;i++){
        cal(a[i-1]+1,a[i]-1);
        // cout<<ans<<endl;        
    }
    cout<<ans<<endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3564kb

input:

8 0 3 3


output:

2

result:

ok single line: '2'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3708kb

input:

11 1 2 4
6

output:

2

result:

ok single line: '2'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3696kb

input:

17 2 5 7
6 12

output:

1

result:

ok single line: '1'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3560kb

input:

30 2 5 6
7 21

output:

5

result:

ok single line: '5'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

38 1 6 6
20

output:

8

result:

ok single line: '8'

Test #6:

score: 0
Accepted
time: 84ms
memory: 8428kb

input:

1000000000000000000 200000 335 557
100001107740026995 100006839102156826 100022686256019614 100026614627087325 100028132190673912 100028139572417710 100034215622293235 100034900480199246 100036139505369203 100044008392310726 100044464248012860 100048368217638304 100053064689708568 100060255356679151...

output:

3577817531189003

result:

ok single line: '3577817531189003'

Test #7:

score: 0
Accepted
time: 30ms
memory: 5896kb

input:

359425126796044126 68013 72652123 104564477
12364747588532 15686712628578 18813370684281 25724948758873 44798252398370 46102702267960 47217527349110 48844320792601 54754265123103 54806360671978 62305720129343 63581566857034 65595780369827 70008379838832 70267866349567 73221506834291 75195943248778 7...

output:

6874665214

result:

ok single line: '6874665214'

Test #8:

score: 0
Accepted
time: 67ms
memory: 6388kb

input:

262596908761956329 168384 3636195729392389 4701187958082704
180856665012 2046521914925 4435875568321 7791606316598 7967918469337 10759374091980 13334965697210 13808557560157 14413058365948 15227606613351 15400179661925 16056774911176 16373092992406 16928423852148 17030158634019 20292485890472 215947...

output:

0

result:

ok single line: '0'

Test #9:

score: 0
Accepted
time: 11ms
memory: 3756kb

input:

182120752693123471 24446 5222 5444
10378437090275 11172570340677 22619272427490 28237570137025 32399061878139 40124230809350 66379513233883 73089169763850 75431308592943 88100676178136 96539264171131 99867522582249 105515696857693 116232680791280 134767581061788 139536195601494 141852652699289 14927...

output:

66882391718207

result:

ok single line: '66882391718207'

Test #10:

score: 0
Accepted
time: 17ms
memory: 3808kb

input:

618640706630768198 37828 924861983 1094084390
55588491214423 62355560535287 67750392137064 109318266217100 123464566398720 125659489407376 129347610524196 133193174843679 146627311659270 151005616010720 179065907374332 184701092167211 202528392053602 261456340065691 286222110380541 294706290720884 3...

output:

1130857948

result:

ok single line: '1130857948'

Test #11:

score: 0
Accepted
time: 32ms
memory: 4256kb

input:

881476573578831848 80000 44 79
72555691666351 77509757815395 77773472573826 85373990157744 105001415881452 120852205497925 133665977400854 148581475247014 154517553727045 154666328655777 158259473705257 167507631093982 168213472450675 171392265103406 180888502239034 184443004586547 186042947889942 1...

output:

21764853668568234

result:

ok single line: '21764853668568234'

Test #12:

score: 0
Accepted
time: 35ms
memory: 6072kb

input:

948792564573514502 80345 30 48
12219747242920 17356669824583 44069602100732 46377973555898 53345896270231 54805430465936 73797431460064 111520238316524 112122519910031 116081664232229 123444299301663 130982470457732 133685472691747 138570742852228 159540354743259 161368560794681 167481361723269 1697...

output:

37951702582891448

result:

ok single line: '37951702582891448'

Test #13:

score: 0
Accepted
time: 54ms
memory: 4724kb

input:

163909913845761226 128089 31568399 43751342
172575303713 3000457788686 3443571216852 6041654468031 6336287956263 7556706050361 8287340699183 11407915310552 15290759349375 16657391431982 18364662349755 18420051226665 18425441071023 20408417671615 20700764746286 21088661317622 21972011597907 223623682...

output:

7492712704

result:

ok single line: '7492712704'

Test #14:

score: 0
Accepted
time: 80ms
memory: 7124kb

input:

822899442500504878 194280 212635219453755143 379406979582891623
4775543983333 6791130266043 8631669216886 10093958291364 17653425498000 18295115670980 20977690939535 21337408539340 24508835889976 24520168455661 29475287800429 32023984008155 35484089213461 37439633876412 49612832954591 55041446601056...

output:

0

result:

ok single line: '0'

Test #15:

score: 0
Accepted
time: 9ms
memory: 3840kb

input:

96714032625698 24908 2863972027 2953205775
3308322170 5226111003 10797112295 18784108258 19822274598 30036705431 35535085260 38627912190 39662892043 51595495720 64489456745 66160370686 72413953194 78807937797 91378943741 91420659440 92238411576 93246917089 99853219993 101077681500 108948890860 11063...

output:

49943

result:

ok single line: '49943'

Test #16:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

169 3 16 26
35 105 143

output:

9

result:

ok single line: '9'

Test #17:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

306 23 13 20
3 23 29 33 67 79 81 84 85 89 93 108 113 150 166 168 186 189 211 212 245 266 272

output:

16

result:

ok single line: '16'

Test #18:

score: 0
Accepted
time: 66ms
memory: 4828kb

input:

47068761889208183 161631 42164418634 57749164246
323588936409 459190426757 594613056665 1287335372887 1395342146866 1556600544184 1939005844997 2234039862941 2844174625765 2905944541617 3384822970590 3953486117420 4166297457888 4206584397299 4241601292960 4268922330815 4339357464597 4660447927297 49...

output:

1528075

result:

ok single line: '1528075'

Test #19:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

30 3 8 15
10 27 28

output:

2

result:

ok single line: '2'

Test #20:

score: 0
Accepted
time: 53ms
memory: 5844kb

input:

230139667889709 140511 454059413 618147327
3907065618 3930556610 4233636571 4690661390 12995546974 13557207227 15075444276 16704142277 18415905760 22841691881 24082622049 25347413381 25712230868 30509796594 35783071041 37407465384 37411516778 39944239772 42260968171 44631433274 44927225548 464085699...

output:

657380

result:

ok single line: '657380'

Test #21:

score: 0
Accepted
time: 54ms
memory: 4700kb

input:

25745839358475954 129360 21387037534 25564520912
95346702917 131666169818 141339963167 165949673344 903984795740 1010405517379 1089856406571 1449548876690 1458143471489 1802105103000 1917505322647 1957338365277 2441703843517 2538801573859 2580333918790 3126248660846 3318594344648 3347470876904 39828...

output:

1929608

result:

ok single line: '1929608'

Test #22:

score: 0
Accepted
time: 53ms
memory: 6424kb

input:

13061306488076 153849 34959776 60602444
6810743 10530459 181327191 402480339 436519548 696874171 736464686 783035402 821316768 827004735 933278149 1026341292 1046777989 1100226815 1324529340 1618239301 1620284521 1829340398 1864972743 1924256817 2161230649 2285344893 2371724504 2412998270 2526199337...

output:

349143

result:

ok single line: '349143'

Test #23:

score: 0
Accepted
time: 86ms
memory: 6112kb

input:

1000000000000000000 199984 59 89
1392043484371 3774291509023 3880275353624 21138298694198 33633666060409 45682547880528 48171088596841 49654253279951 50409217429172 58932674345741 63832542576504 64531979969971 68581739068996 71471409248752 71815611575264 78497563942933 78570944302446 83032448375242 ...

output:

21978021977897119

result:

ok single line: '21978021977897119'

Test #24:

score: 0
Accepted
time: 88ms
memory: 5196kb

input:

1000000000000000000 199947 62 119
1768143964670 3551818283253 4417874115465 8632437464920 11167140437906 12441209858164 19311369703150 27432778562883 30180972948862 64083673275342 66930106105287 68783632713372 73536860547263 81549965503053 88075401898461 95213659819398 101535599446473 10375403546286...

output:

16528925619729160

result:

ok single line: '16528925619729160'

Test #25:

score: 0
Accepted
time: 87ms
memory: 5788kb

input:

1000000000000000000 199914 49 76
5310954831666 9686731572776 12061010528745 18372313562762 24579325382939 33008685549901 34439497754326 41811739285845 44530097521226 51631571257496 53922597763424 54810436287001 62422818828130 70348082074187 84828307401187 84914386996864 88083743204125 10162042787878...

output:

25641025640902369

result:

ok single line: '25641025640902369'

Test #26:

score: 0
Accepted
time: 87ms
memory: 6232kb

input:

1000000000000000000 199949 1690052 1774021
5850465264181 7720490744452 9519727141271 14527626378312 22470967929082 29559521461733 35017561475483 45923638705651 46529614128701 47143236294837 48255979746878 56334117617889 67545905625843 68252693336724 74281867574025 78783369155692 80692317859551 83519...

output:

1127380966058

result:

ok single line: '1127380966058'

Test #27:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

1 0 1 1


output:

0

result:

ok single line: '0'

Test #28:

score: -100
Wrong Answer
time: 0ms
memory: 3592kb

input:

2 0 1 1


output:

0

result:

wrong answer 1st lines differ - expected: '1', found: '0'