QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#218151#6443. Windblume FestivalHurrikale#WA 0ms1512kbC++14951b2023-10-17 19:13:462023-10-17 19:13:46

Judging History

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

  • [2023-10-17 19:13:46]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:1512kb
  • [2023-10-17 19:13:46]
  • 提交

answer

#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
int Read()
{
    int Output=0,W=1;
    char Input=getchar();
    while(Input<'0'||Input>'9')
    {
        if(Input=='-')W=-1;
        Input=getchar();
    }
    while(Input>='0'&&Input<='9')
    {
        Output=Output*10+Input-'0';
        Input=getchar();
    }
    return Output*W;
}
ll ABS(ll X)
{
    return (X>0?X:-X);
}
const int Inf=1e9+1;
int T;
int N;
ll Total;
ll Max=-Inf,Min=Inf;
int main()
{
    T=Read();
    while(T--)
    {
        Total=0,Min=Inf,Max=-Inf;
        N=Read();
        for(int i=1;i<=N;++i)
    {
        ll X=Read();
        Min=min(X,Min);
        Max=max(X,Max);
        Total+=ABS(X);
    }
    printf("%lld %lld\n",Min,Max);
    if(Min<0&&Max>0)printf("%lld",Total);
    else if(Max<=0)printf("%lld",Total-(ABS(Max)<<1));
    else printf("%lld",Total-Min*2);
    putchar('\n');
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 1512kb

input:

5
4
1 -3 2 -4
11
91 66 73 71 32 83 72 79 84 33 93
12
91 66 73 71 32 83 72 79 84 33 33 93
13
91 66 73 71 32 83 72 79 84 33 33 33 93
1
0

output:

-4 2
10
32 93
713
32 93
746
32 93
779
0 0
0

result:

wrong answer 1st numbers differ - expected: '10', found: '-4'