QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#215811#6443. Windblume Festivalveg#WA 133ms3808kbC++14400b2023-10-15 13:46:212023-10-15 13:46:21

Judging History

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

  • [2023-10-15 13:46:21]
  • 评测
  • 测评结果:WA
  • 用时:133ms
  • 内存:3808kb
  • [2023-10-15 13:46:21]
  • 提交

answer

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

const int N=1e6+5;
int a[N];
int main() {
	int T; scanf("%d",&T);
	while(T--) {	
		int n; scanf("%d",&n); ll ans=0;
		for(int i=1;i<=n;++i) scanf("%d",&a[i]),ans+=abs(a[i]);
		ll s=0;
		for(int i=1;i<=n;++i) {
			int j=i%n+1;
			s=max(s,ans-abs(a[i])-abs(a[j])+a[i]-a[j]);
		}
		printf("%lld\n",s);
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3804kb

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:

10
713
746
779
0

result:

ok 5 number(s): "10 713 746 779 0"

Test #2:

score: -100
Wrong Answer
time: 133ms
memory: 3808kb

input:

1000000
1
2
1
-2
1
1
1
-1
1
2
1
1
1
2
1
-2
1
-2
1
2
1
1
1
1
1
2
1
2
1
2
1
-2
1
-2
1
0
1
2
1
1
1
-1
1
0
1
-2
1
0
1
1
1
1
1
-2
1
-2
1
2
1
1
1
2
1
1
1
1
1
0
1
2
1
0
1
-1
1
-1
1
-2
1
-2
1
0
1
-2
1
0
1
1
1
-1
1
2
1
0
1
-2
1
-2
1
0
1
1
1
-1
1
-2
1
-1
1
0
1
-1
1
-1
1
-1
1
-1
1
1
1
2
1
0
1
0
1
-2
1
2
1
2
1
...

output:

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

result:

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