Wrong Answer
Code
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
vector<int> arr(n);
for (int i = 0; i < n; i++)
cin >> arr[i];
sort(arr.rbegin(), arr.rend());
int res = arr[0];
if (n == 2 || arr[2] <= 0)
res -= arr[1];
cout << res << endl;
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1208 C. Game on Integer
- Contest
- Educational Round 1
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2025-07-14 16:59:45
- Judged At
- 2025-07-14 16:59:45
- Judged By
- Score
- 5
- Total Time
- 15ms
- Peak Memory
- 580.0 KiB