QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#563592#9266. Dynamic Traffic with MegaFonPhantomThreshold#AC ✓35ms3740kbC++20535b2024-09-14 14:03:022024-09-14 14:03:04

Judging History

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

  • [2024-09-14 14:03:04]
  • 评测
  • 测评结果:AC
  • 用时:35ms
  • 内存:3740kb
  • [2024-09-14 14:03:02]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);

    int n; cin>>n;
    int las=-1;
    ll ans=0;
    for(int i=1;i<=n;i++)
    {
        int x; cin>>x;
        if(i==1)
        {
            las=x;
        }
        else if(x>0)
        {
            ans+= max(las,x);
            las=x;
        }
        else if(las>0)
        {
            ans+=max(las,x);
            las=x;
        }
    }
    cout<<ans<<endl;

    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
5 -3 -2 1

output:

6

result:

ok answer is '6'

Test #2:

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

input:

4
-1 -1 -1 -1

output:

0

result:

ok answer is '0'

Test #3:

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

input:

1
0

output:

0

result:

ok answer is '0'

Test #4:

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

input:

1
1

output:

0

result:

ok answer is '0'

Test #5:

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

input:

1
-1

output:

0

result:

ok answer is '0'

Test #6:

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

input:

10
-459 615 -847 354 -816 127 727 729 593 -676

output:

4843

result:

ok answer is '4843'

Test #7:

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

input:

100
-879757 -254968 -949084 -695951 419739 579417 378479 -968455 456392 856315 800624 -612748 127062 14644 950510 -284086 293402 939980 -825728 277458 -422286 579924 786095 525450 -847415 243602 -387115 601589 -583152 674777 -550386 434193 -618067 -195703 -402630 17304 -339689 738648 92364 -352648 1...

output:

39899042

result:

ok answer is '39899042'

Test #8:

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

input:

1000
854717981 -556182167 -866340825 -912269890 30895368 -406957426 682479377 -443875120 -933515024 971673016 -48966596 -789649301 606978804 365578078 114257918 -732699093 420486454 323662429 626589040 -294172598 707704488 67338750 162638096 -441663920 -722789845 -870989351 -257997778 706428254 -787...

output:

394354798121

result:

ok answer is '394354798121'

Test #9:

score: 0
Accepted
time: 1ms
memory: 3612kb

input:

10000
775095262 531931347 -960517082 481280942 115271141 995254899 212373404 855119608 160018795 -378255769 7322655 -584433427 130619019 946579368 153322687 -976288891 -546077054 -170400416 477686518 -264819353 382205154 -266565875 638552109 291983357 755343478 -377920084 -274632402 -33279134 -81089...

output:

4175706614553

result:

ok answer is '4175706614553'

Test #10:

score: 0
Accepted
time: 8ms
memory: 3612kb

input:

100000
562839561 445139756 128963821 -403571480 -31281203 -306593866 882949493 274458583 991497966 684583422 754343382 -366348713 263478884 113984157 147646623 239453531 585933039 982469640 658955450 -818667210 245576140 93498061 701056315 -605158281 -539594223 -400851367 776858158 -122004876 288965...

output:

41764788099373

result:

ok answer is '41764788099373'

Test #11:

score: 0
Accepted
time: 33ms
memory: 3688kb

input:

500000
114508315 -509577053 322934462 -253112558 869149407 -529225308 -464304797 330517381 -470727462 56788634 -180409544 75560630 -767230280 726724925 -561372999 -709675546 940946661 -743020832 -153004776 -629398395 875280149 -56882961 -261596654 -438375022 647362953 -226983615 884474719 -116078517...

output:

208044685272111

result:

ok answer is '208044685272111'

Test #12:

score: 0
Accepted
time: 34ms
memory: 3728kb

input:

500000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000...

output:

499999000000000

result:

ok answer is '499999000000000'

Test #13:

score: 0
Accepted
time: 10ms
memory: 3732kb

input:

500000
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...

output:

0

result:

ok answer is '0'

Test #14:

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

input:

500000
-1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000...

output:

0

result:

ok answer is '0'

Test #15:

score: 0
Accepted
time: 20ms
memory: 3664kb

input:

500000
0 1 1 2 1 0 2 2 1 2 2 0 1 1 0 0 0 0 1 1 1 2 0 2 1 1 0 1 1 2 0 0 0 2 0 1 1 1 1 0 2 2 1 0 1 2 2 0 1 1 2 2 2 2 2 0 1 0 0 2 2 2 0 0 2 2 1 1 1 1 0 1 0 2 1 1 0 0 2 2 1 2 0 1 2 0 1 0 1 2 2 0 2 1 0 0 1 1 1 2 2 2 2 0 2 1 0 1 0 2 0 1 2 0 0 0 1 0 2 1 2 1 1 1 1 2 0 2 2 2 2 1 0 1 1 0 2 2 2 0 2 2 0 0 2 2 2...

output:

721723

result:

ok answer is '721723'

Test #16:

score: 0
Accepted
time: 22ms
memory: 3688kb

input:

500000
-2 -1 -1 -1 -2 -2 -2 -2 0 0 0 0 -2 -2 -1 -2 0 -2 -2 -2 0 -2 0 -2 -2 -1 0 -2 -1 -1 -2 -2 0 -1 -1 -1 0 -1 0 -1 -2 -2 0 0 -1 -2 0 -1 -1 0 -2 0 0 -2 -1 -2 -1 -1 0 -2 -1 -2 -1 -2 -2 0 -1 -2 -1 -2 0 -1 -2 -2 0 -2 -2 0 -1 -1 -2 -2 -2 -1 -1 -2 -2 0 0 0 -1 0 -2 -2 -1 -2 -2 -1 0 0 0 -1 0 0 0 -1 -2 -2 0...

output:

0

result:

ok answer is '0'

Test #17:

score: 0
Accepted
time: 23ms
memory: 3736kb

input:

500000
1 -1 1 0 1 0 1 1 -1 -1 1 1 0 0 1 1 -1 0 -1 -1 1 1 -1 0 -1 -1 0 1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 0 1 -1 0 1 0 0 -1 1 -1 0 -1 -1 -1 1 1 0 0 -1 -1 -1 0 1 1 0 0 -1 1 -1 1 0 1 0 1 1 -1 -1 0 -1 -1 -1 -1 0 -1 -1 -1 1 1 1 -1 -1 1 1 -1 -1 0 0 1 -1 1 0 0 0 1 0 1 1 -1 1 -1 0 -1 1 1 -1 -1 1 0 -1 1 1 0 -1 ...

output:

278172

result:

ok answer is '278172'

Test #18:

score: 0
Accepted
time: 34ms
memory: 3660kb

input:

500000
-669321293 956195205 711022900 284344082 773557124 984032349 -97520199 780084857 375292456 887413295 222299212 53672661 -895687962 449231151 923533459 164658334 593837711 292298483 -427946306 128379431 235076986 482935813 865478781 1349017 -395456591 60732535 794253317 908374157 511597745 460...

output:

305519301950600

result:

ok answer is '305519301950600'

Test #19:

score: 0
Accepted
time: 34ms
memory: 3732kb

input:

500000
-550227153 406915656 -115498735 435613352 -640024027 210458476 -286235918 361643024 -572275901 911933111 -311089209 15375401 -999311510 963538704 -191165928 641798327 -84955357 808941290 -473172329 215867654 -485357110 933965876 -626208791 567140110 -600893328 59445204 -306050550 307157451 -8...

output:

249961307732168

result:

ok answer is '249961307732168'

Test #20:

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

input:

500000
-289564315 -800831331 -313244035 -546895115 -216477665 729450922 -771453705 -640785540 -213503197 -308104373 -687199648 620185971 -183823309 -339485059 -560816385 -277183965 -70749827 210417589 -427214627 -157447040 -284936515 -545216981 -74925296 862962062 -798668546 -842978497 -581567623 -8...

output:

83349936413404

result:

ok answer is '83349936413404'

Test #21:

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

input:

500000
-47364718 -251664998 -731610465 -796460242 -926629577 -104207643 -15283712 -487631321 -507110960 -569080120 -985240118 -359262740 -658677083 -463781259 -884704627 -923341056 -982415118 -111164579 -388450113 -835621557 -937678214 -954660181 -494577178 -478889074 -75489263 -861231909 -812710461...

output:

192984525730892

result:

ok answer is '192984525730892'

Test #22:

score: 0
Accepted
time: 34ms
memory: 3616kb

input:

500000
-495367738 -50269361 -904568390 -43538586 -677712640 -440266110 -943401115 -971473917 -595779578 -362630942 -40919097 -277728552 -409092544 -516655377 -138325056 -301270651 -780923341 -8598679 -447011045 -256414455 -615535391 -205131123 -770523792 -426595713 -335506670 -610368642 -551869710 -...

output:

94853296746018

result:

ok answer is '94853296746018'

Extra Test:

score: 0
Extra Test Passed