QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#464634#6443. Windblume Festivalyounger#WA 121ms3532kbC++20963b2024-07-06 13:16:132024-07-06 13:16:15

Judging History

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

  • [2024-07-06 13:16:15]
  • 评测
  • 测评结果:WA
  • 用时:121ms
  • 内存:3532kb
  • [2024-07-06 13:16:13]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define int long long
using i64 = long long;

typedef pair<int, int> PII;
typedef pair<int, char> PIC;
typedef pair<double, double> PDD;
typedef pair<int, PII> PIII;
typedef pair<int, pair<int, bool>> PIIB;

const int N = 10;
const int maxn = 1e6 + 10;
const int mod = 998244353;
const int mod1 = 954169327;
const int mod2 = 906097321;
const int INF = 0x3f3f3f3f3f3f3f3f;

void solve()
{
    int n;
    cin >> n;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; i ++ ) cin >> a[i];
    sort(a.begin() + 1, a.end());
    int ans = 0;
    for (int i = 1; i <= n; i ++ )
    {
        if (i == 1) ans -= a[i];
        else
        {
            ans += abs(a[i]);
        }
    }
    cout << ans << '\n';
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
}

詳細信息

Test #1:

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

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: 121ms
memory: 3532kb

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:

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

result:

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