QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#218151 | #6443. Windblume Festival | Hurrikale# | WA | 0ms | 1512kb | C++14 | 951b | 2023-10-17 19:13:46 | 2023-10-17 19:13:46 |
Judging History
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'