QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#497599#6443. Windblume FestivalzmrzmrWA 423ms3696kbC++14513b2024-07-29 14:41:192024-07-29 14:41:20

Judging History

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

  • [2024-07-29 14:41:20]
  • 评测
  • 测评结果:WA
  • 用时:423ms
  • 内存:3696kb
  • [2024-07-29 14:41:19]
  • 提交

answer

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

const int N = 1e6+5;
ll a[N];
int main()
{
	int tcase;
	cin>>tcase;
	while(tcase--)
	{
		ll ans = 0 ;
		ll ans1 = 0;
		int n;
		cin>>n;
		int cnt;
		for(int i = 1 ; i <= n ; i++ )
		{
			cin>>a[i];
			ans+=abs(a[i]);
		}
		for(int i = 1 ; i <= n ; i++ )
		{
			ans1 = max(ans1 , ans - abs(a[i]) - abs(a[i%n+1]) + (a[i] - a[i%n+1]));
		}
		if(n==1)
		{
			cout<<0<<endl;
			continue;
		}
		cout<<ans1<<endl;
	}
 } 

详细

Test #1:

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

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: 423ms
memory: 3632kb

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'