QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#563583#9266. Dynamic Traffic with MegaFonPhantomThreshold#WA 0ms3700kbC++20527b2024-09-14 13:59:342024-09-14 13:59:35

Judging History

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

  • [2024-09-14 13:59:35]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3700kb
  • [2024-09-14 13:59:34]
  • 提交

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 fir=1,las=-1;
    ll ans=0;
    for(int i=1;i<=n;i++)
    {
        int x; cin>>x;
        if(x>0)
        {
            if(fir!=1) ans+= max(las,x);
            las=x;
            fir=0;
        }
        else if(las>0)
        {
            ans+=max(las,x);
            las=x;
            fir=0;
        }
    }
    cout<<ans<<endl;

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
5 -3 -2 1

output:

6

result:

ok answer is '6'

Test #2:

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

input:

4
-1 -1 -1 -1

output:

0

result:

ok answer is '0'

Test #3:

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

input:

1
0

output:

0

result:

ok answer is '0'

Test #4:

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

input:

1
1

output:

0

result:

ok answer is '0'

Test #5:

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

input:

1
-1

output:

0

result:

ok answer is '0'

Test #6:

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

input:

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

output:

4228

result:

wrong answer expected '4843', found '4228'